Changeset 747c501 for lib/trace.c


Ignore:
Timestamp:
04/27/06 00:48:42 (15 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
e641bdc
Parents:
d97bbb2
Message:

Fix some memory leaks
Add new destroy for bpf filters
Properly initialise memory for wag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rd97bbb2 r747c501  
    922922DLLEXPORT struct libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
    923923#if HAVE_BPF
    924         struct libtrace_filter_t *filter = (struct libtrace_filter_t*)
     924        libtrace_filter_t *filter = (struct libtrace_filter_t*)
    925925                                malloc(sizeof(struct libtrace_filter_t));
    926926        filter->filterstring = strdup(filterstring);
     
    931931        return 0;
    932932#endif
     933}
     934
     935DLLEXPORT void trace_destroy_bpf(libtrace_filter_t *filter)
     936{
     937        free(filter->filterstring);
     938        if (filter->flag)
     939                pcap_freecode(&filter->filter);
     940        free(filter);
    933941}
    934942
Note: See TracChangeset for help on using the changeset viewer.