svn commit: samba r12803 - in branches/SAMBA_4_0/source/librpc/ndr: .

Herb Lewis hlewis at panasas.com
Mon Jan 9 22:29:05 GMT 2006


Isn't the result of this fix going to be the same? Now you just have a
valid pointer to freed memory.

metze at samba.org wrote:
> Author: metze
> Date: 2006-01-09 21:59:42 +0000 (Mon, 09 Jan 2006)
> New Revision: 12803
> 
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12803
> 
> Log:
> if we free the ndr structure how should we access the private pointer anymore?
> 
> thanks valgrind!
> 
> metze
> Modified:
>    branches/SAMBA_4_0/source/librpc/ndr/ndr.c
> 
> 
> Changeset:
> Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
> ===================================================================
> --- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2006-01-09 21:58:40 UTC (rev 12802)
> +++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2006-01-09 21:59:42 UTC (rev 12803)
> @@ -272,6 +272,7 @@
>  				int flags, void *ptr)
>  {
>  	struct ndr_print *ndr;
> +	char *ret;
>  
>  	ndr = talloc_zero(mem_ctx, struct ndr_print);
>  	if (!ndr) return NULL;
> @@ -280,8 +281,9 @@
>  	ndr->depth = 1;
>  	ndr->flags = 0;
>  	fn(ndr, name, flags, ptr);
> +	ret = ndr->private;
>  	talloc_free(ndr);
> -	return ndr->private;
> +	return ret;
>  }
>  
>  void ndr_set_flags(uint32_t *pflags, uint32_t new_flags)


More information about the samba-technical mailing list