Use after talloc_free...
rusty at rustcorp.com.au
Thu Nov 12 01:21:18 MST 2009
On Thu, 12 Nov 2009 05:36:40 pm Volker Lendecke wrote:
> On Thu, Nov 12, 2009 at 12:05:19PM +1030, Rusty Russell wrote:
> > To be clear: I *don't* want magic NULL-ing. If you want to NULL a pointer
> > because you're going to re-use it, I'd much rather that be explicit. I want
> > an instant way to detect use-after-free, whether it be double-free or other
> > cases where NULL would be treated as special and mask the bug.
> Wait a second -- you want to use a point *after* you called
> talloc_free on it?
No, I want to make sure it crashes if someone does.
NULL often gets treated specially. This means two things:
1) It often doesn't crash (eg. you talloc_realloc it, or talloc_steal it, or
2) People come to rely on the implicit nulling of the pointer. If you
want to reuse it, I want you to NULL it explicitly to show you mean it.
Hope that clarifies,
More information about the samba-technical