Re: deallocation problem or conflict ?



Hi Peter,

On Mon, 2003-05-05 at 16:21, Peter Van Osta wrote:
> I am also puzzled
> how to free the return value "EzxRdrImgObj" on the client side after the
> transfer of the image data to the client.

	All ORB allocated values; and values returned into the ORB - have to be
allocated (and thus freed) using the ORB allocators (obviously). Thus
you should use CORBA_free.
	
> 	retval->type = ( CORBA_short )ImageTypeIdent( rdimg );	
> 	retval->width = ( CORBA_long )ImageWidth( rdimg );
> 	retval->height = ( CORBA_long )ImageHeight( rdimg );
> 	retval->depth = ( CORBA_long )ImageDepth( rdimg );
> 	retval->slice = 0;

	Do you really need those CORBA_foo casts ? the rest of the code looks
fine except for: 

> 	retval->data._release = ( CORBA_boolean )FALSE;
> 	CORBA_sequence_set_release( &( retval->data ), FALSE );

	In fact you want to set release TRUE on that sequence, just once;so I'd
use the CORBA_sequence_set_ method for that;

	It seems that you don't free your rdimage in the code you pasted; but
you leak the sequence. If you are still having problems you can't
understand, I would strongly suggest building 'valgrind' and running
that (--alignment=8) on your code.

	HTH,

		Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]