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

Stefan (metze) Metzmacher metze at samba.org
Mon Jan 9 22:40:30 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

no, as the ndr->private is talloc'ed with the callers 'mem_ctx' as parent,
not the ndr structure.

>> 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;

here we have this:
	ndr->private = talloc_strdup(mem_ctx, "");

>> @@ -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)


- --
metze

Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDwuZcm70gjA5TCD8RAhEEAKCat9KN/FbYQ6q3Rtvh+oDfL1OOHwCfduw0
R0HN67nS+nZr1Q07tdo0iik=
=+I1u
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list