Changeset 9857d1c


Ignore:
Timestamp:
06/24/14 17:54:32 (6 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

Location:
lib
Files:
2 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
  • lib/trace_parallel.c

    r5ba34eb r9857d1c  
    332332        message.additional.uint64 = 0;
    333333        (*trace->per_pkt)(trace, NULL, &message, t);
     334
     335        // Free our last packet
     336        if (packet)
     337                trace_destroy_packet(packet);
    334338
    335339        // And we're at the end free the memories
     
    11821186        }
    11831187        libtrace_ringbuffer_init(&libtrace->packet_freelist, libtrace->packet_freelist_size, LIBTRACE_RINGBUFFER_BLOCKING);
    1184         libtrace_slidingwindow_init(&libtrace->sliding_window, libtrace->packet_freelist_size, 0);
     1188        //libtrace_slidingwindow_init(&libtrace->sliding_window, libtrace->packet_freelist_size, 0);
    11851189        assert(sem_init(&libtrace->sem, 0, libtrace->packet_freelist_size) == 0);
    11861190        // This will be applied to every new thread that starts, i.e. they will block all signals
Note: See TracChangeset for help on using the changeset viewer.