Changeset e375e0f for lib/libtrace_int.h


Ignore:
Timestamp:
02/28/18 15:11:24 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
e4eaca5
Parents:
5c07bfe
Message:

Fix bug where libtrace-created hasher_data was leaked.

If trace_set_hasher was called with a null hasher, libtrace
would malloc memory for storing hasher_data. However, that
memory was never freed, since we had no way of telling whether
that memory had been externally allocated and passed in to
trace_set_hasher or if the memory had been allocated by libtrace.

Added a flag to the libtrace_t structure that records who owns
hasher_data and will now free it during trace_destroy if the
memory was allocated by libtrace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace_int.h

    rc7e547e re375e0f  
    182182        THREAD_PAUSED,
    183183        THREAD_STATE_MAX
     184};
     185
     186enum hash_owner {
     187        HASH_OWNED_LIBTRACE,
     188        HASH_OWNED_EXTERNAL,
    184189};
    185190
     
    347352        fn_hasher hasher;
    348353        void *hasher_data;
     354        enum hash_owner hasher_owner;
    349355        /** The pread_packet choosen path for the configuration */
    350356        int (*pread)(libtrace_t *, libtrace_thread_t *, libtrace_packet_t **, size_t);
Note: See TracChangeset for help on using the changeset viewer.