Re: memory leak ?
Michael Meeks <[email protected]> 12 May 2003 13:09:37 +0100
| Newsgroups | gmane.comp.gnome.components,gmane.comp.gnome.orbit.general |
|---|---|
| Organization | Ximian. |
| Message-ID | <[email protected]> |
Hi Peter, On Tue, 2003-05-06 at 14:07, Peter Van Osta wrote: > I thought that sequentialy freeing first the embedded octet sequence and > then the structure itself would do the job ? I am now testing the > behaviour of the sytem, so not everything has been completed, but the > transfer of image data should work ? Nope - CORBA_free does a deep free that is informed (magically) by the types it knows are embedded in the return value. This is done using a smart allocation tracker; Thus you just need to free the return value and it'll all go away nicely :-) > if( img->data._buffer ) > CORBA_free( img->data._buffer ); > free( img ); Bin those lines; and do: CORBA_free (img); also our CORBA_free silently tolerates NULL, so you can just do: CORBA_free (message) for a cleaner code-path :-) You are however missing a vital: if (ev._major != CORBA_NO_EXCEPTION) /* exit cleanly */ - using the results of a CORBA method without checking for exceptions first is dangerous, undefined behavior. HTH, Michael. -- [email protected] <><, Pseudo Engineer, itinerant idiot