Ethereal-dev: Re: [Ethereal-dev] Wicked bug

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 19 Dec 2003 15:11:11 -0800

On Dec 19, 2003, at 1:34 PM, Biot Olivier wrote:

BTW what do CLEANUP_PUSH(g_free, strval) and CLEANUP_CALL_AND_POP do?

The first of those pushes onto a stack of "cleanup" routines an entry that says "if an exception is thrown, call 'g_free()' with 'strval' as an argument". The second of those pops that entry off the stack and makes the call in question.

I.e., the first one arranges that, even if the second "get_text_string()" call throws an exception because the string runs past the end of the tvbuff, "strval" will be freed. The second one cleans the entry for that off the stack, and frees "strval".