Changeset 797 for trunk/lib/trace.c


Ignore:
Timestamp:
05/11/06 11:40:21 (7 years ago)
Author:
spa1
Message:

Fixed segmentation faults when trace_destroy is called on a trace that wasn't successfully created
libdl is now checked for and only linked against if available (BSD's don't have a libdl)
Fixed the libpacketdump .so's to use libtrace's generic protocol headers as well as trace_ether_ntoa
Added missing check for strlcpy
Added a couple of #defines to various tools that needed them under FreeBSD
Removed some needless #includes from the libpacketdump .so's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/trace.c

    r795 r797  
    577577DLLEXPORT void trace_destroy(libtrace_t *libtrace) { 
    578578        assert(libtrace); 
    579         if (libtrace->started && libtrace->format->pause_input) 
    580                 libtrace->format->pause_input(libtrace); 
    581         libtrace->format->fin_input(libtrace); 
     579        if (libtrace->format) { 
     580                if (libtrace->started && libtrace->format->pause_input) 
     581                        libtrace->format->pause_input(libtrace); 
     582                libtrace->format->fin_input(libtrace); 
     583        } 
    582584        /* need to free things! */ 
    583         free(libtrace->uridata); 
    584         destroy_tracefifo(libtrace->fifo); 
     585        if (libtrace->uridata) 
     586                free(libtrace->uridata); 
     587        if (libtrace->fifo) 
     588                destroy_tracefifo(libtrace->fifo); 
    585589        free(libtrace); 
    586590} 
Note: See TracChangeset for help on using the changeset viewer.