ldb_dn_copy(): should we take a talloc_reference?
jra at samba.org
Mon Feb 12 19:48:47 UTC 2018
On Thu, Feb 08, 2018 at 06:37:29AM +0100, Volker Lendecke via samba-technical wrote:
> On Thu, Feb 08, 2018 at 04:26:22PM +1300, Andrew Bartlett via samba-technical wrote:
> > * On one hand, I would say that the answer is to make the struct ldb_dn
> > take a talloc_reference() to the ldb and assign the element in
> > ldb_dn_copy(). (We would then also need to take the reference in
> > ldb_dn_new()). On the other, I can hear the howls of protest already.
> Just very recently I've been in source4/nbt_server.c and libcli/nbt/.
> This is old code doing significant amounts of talloc_reference. This
> gave me significant amounts of grief. I do not claim I even remotely
> understand what you're talking about, but "talloc_reference" is really
> a trigger word for me, re-confirmed by very recent experience.
> Just. Don't. Do. It.
> Please find other ways to deal with your problem without
Even sick with flu, I have to add my +1 to this.
Please do *NOT* add any more talloc_reference() calls.
It's probably too late to end up removing all talloc_reference()
from Samba, but given infinite resources that's where I'd want
us to end up.
It's at least as dangerous as strcpy(), which I managed to
ban a long time ago, but harder to find bugs with as the
problems are not as immediately apparent.
If you have to reference count, add an explicit reference
More information about the samba-technical