Changeset 9857d1c for lib/trace.c


Ignore:
Timestamp:
06/24/14 17:54:32 (7 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
aa5a642
Parents:
10e183f
Message:

Fix some memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r85e87b5 r9857d1c  
    642642DLLEXPORT void trace_destroy(libtrace_t *libtrace) {
    643643    int i;
    644         assert(libtrace);
     644        assert(libtrace);
     645
     646        /* destroy any packet that are still around */
     647        if (libtrace->first_packets.packets) {
     648                for (i = 0; i < libtrace->perpkt_thread_count; ++i) {
     649                        if(libtrace->first_packets.packets[i].packet) {
     650                                trace_destroy_packet(libtrace->first_packets.packets[i].packet);
     651                        }
     652                }
     653                free(libtrace->first_packets.packets);
     654        }
     655
    645656        if (libtrace->format) {
    646657                if (libtrace->started && libtrace->format->pause_input)
     
    681692                 free(libtrace->event.packet);
    682693        }
    683         free(libtrace);
     694        free(libtrace);
    684695}
    685696
Note: See TracChangeset for help on using the changeset viewer.