Changeset 5fe998b for lib/trace.c


Ignore:
Timestamp:
01/08/19 10:09:47 (22 months ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Children:
4ac48fa
Parents:
2bce91d
Message:

Make sure we zero any filter structures we allocate

This fixes "uninitialised bytes" warnings that we get from
valgrind whenever filters are used with ring:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rd439067 r5fe998b  
    15541554#else
    15551555        struct libtrace_filter_t *filter = (struct libtrace_filter_t *)
    1556                 malloc(sizeof(struct libtrace_filter_t));
     1556                calloc(1, sizeof(struct libtrace_filter_t));
    15571557        filter->filter.bf_insns = (struct bpf_insn *)
    15581558                malloc(sizeof(struct bpf_insn) * bf_len);
     
    15781578#ifdef HAVE_BPF
    15791579        libtrace_filter_t *filter = (libtrace_filter_t*)
    1580                                 malloc(sizeof(libtrace_filter_t));
     1580                                calloc(1, sizeof(libtrace_filter_t));
    15811581        filter->filterstring = strdup(filterstring);
    15821582        filter->jitfilter = NULL;
Note: See TracChangeset for help on using the changeset viewer.