[Bro] Do I have to free params sent to mgr.dispatch ?
Siwek, Jon
jsiwek at illinois.edu
Tue Jan 20 08:23:43 PST 2015
> On Jan 19, 2015, at 6:06 AM, John Donnelly <jdonnelly at dyn.com> wrote:
>
> Given the following sample:
>
> RecordVal* r = new RecordVal(dns_telemetry_qname_stats); r->Assign(0, new Val(ts, TYPE_DOUBLE));
>
> r->Assign(1, new StringVal(key));
>
> r->Assign(2, new Val(qname_v->zone_id, TYPE_COUNT));
>
> r->Assign(3, new Val(qname_v->cust_id, TYPE_COUNT));
>
> r->Assign(4, new Val(qname_v->cnt, TYPE_COUNT));
>
> r->Assign(5, new StringVal(sts));
>
> val_list* vl = new val_list;
>
> vl->append(r);
>
> mgr.Dispatch(new Event(dns_telemetry_qname_info, vl), true);
>
>
>
> Does Dispatch delete these resources ?
It should. Dispatch() will call all event handlers immediately. QueueEvent() is commonly used in most places in the code, and will dispatch it at a later time. You can also check if “dns_telemetry_qname_info” evaluates to true before creating the argument list — i.e. if no event handler is defined, you don’t need to create arguments for it.
- Jon
More information about the Bro
mailing list