"const" patches

Stefan (metze) Metzmacher metze at samba.org
Fri Nov 20 07:25:02 MST 2009


Matthias Dieter Wallnöfer schrieb:
> Hi all,
> 
> after some rework and improvements (especially some very good suggestions by abartlet - Thanks to him!) these are those four patches which I would see to be applied to the common codebase in the "master" branch. There is one commit for the TDB tools, one for the ICONV test, one for the NBT library and the last one for the string lists.
> 
> I hope to get some constructive comments to be able to finish this work.

I'll push 3 patches to master, after make test is finished.

I think this is wrong as cname is maybe the talloc chunk with the scope
at the end, but with a \0 in the middle. We should not expose such a
string to the caller, as the caller may want to use
talloc_*_append_buffer().

-	r->name = talloc_strdup(ndr->current_mem_ctx, cname);
-	NDR_ERR_HAVE_NO_MEMORY(r->name);
-
-	talloc_free(cname);
+	r->name = talloc_steal(ndr->current_mem_ctx, cname);

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091120/8abd855e/attachment.pgp>


More information about the samba-technical mailing list