aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugin_api.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-08-28 07:19:47 +0000
committerGuy Harris <guy@alum.mit.edu>2001-08-28 07:19:47 +0000
commitd9019638eef40ef97c69e7a28277d1886aa800cc (patch)
tree584deb575af82faf0d42803f71300ed91de7bd5f /plugins/plugin_api.c
parent9cef3b28ad150725ff8196230b13ecc0f643a220 (diff)
Free allocated memory as soon as we're done with it. In many cases,
this obviates the need to add cleanup handlers for exceptions, if we move a free call so that there are no tvbuff references between the allocation and the free. Checking for that also found some cases where frees were missing, and one loop where a call was made to allocate stuff but the free was only done after the exit from the loop. In cases where we can't move the free up above tvbuff references, register cleanup handlers, and replace the free with CLEANUP_CALL_AND_POP. Eliminate some initializations of pointers to null - the initializations aren't necessary (or ceased to be necessary after the frees were moved up). In the "force an exception" code in "get_CDR_octet_seq()", touch the first byte after the string, to make it more likely that we'll throw the correct exception (e.g., throw a "past end of captured data" exception rather than a "past end of data" exception). There's no need for "get_CDR_string()" to force an exception, as it just calls "get_CDR_octet_seq()", which will do it for us. However, as the result of "get_CDR_string()" is often processed as a string, if the length is 0 it should just "g_strdup()" a null string, rather than not doing anything (and relying on the pointer variable being initialized to null). It's not always safe to treat a null pointer as if it pointed to a string (in fact, it is often most definitely unsafe). svn path=/trunk/; revision=3878
Diffstat (limited to 'plugins/plugin_api.c')
0 files changed, 0 insertions, 0 deletions