Use after talloc_free...

Kai Blin kai at samba.org
Wed Nov 11 04:48:34 MST 2009


On Wednesday 11 November 2009 12:37:07 Volker Lendecke wrote:
> On Wed, Nov 11, 2009 at 12:33:29PM +0100, Kai Blin wrote:
> > TALLOC_FREE is used in the shared code already. Why come up with yet
> > another way to do it(tm)? Personally I think coding on Samba is
> > complicated enough already.
>
> Because Rusty hates SHOUTING? :-)

Attached patch would fix that, I guess?

Cheers,
Kai

-- 
Kai Blin
WorldForge developer  http://www.worldforge.org/
Wine developer        http://wiki.winehq.org/KaiBlin
Samba team member     http://www.samba.org/samba/team/
--
Will code for cotton.
-------------- next part --------------
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index f549a17..5819862 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -112,7 +112,7 @@ typedef void TALLOC_CTX;
 #define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__)
 
 #define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type)
-#define talloc_free(ctx) _talloc_free(ctx, __location__)
+#define talloc_free(ctx) do { _talloc_free(ctx, __location__); ctx=NULL; } while (0)
 
 
 #if TALLOC_DEPRECATED
@@ -124,7 +124,7 @@ typedef void TALLOC_CTX;
 #define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
 #endif
 
-#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)
+#define TALLOC_FREE(ctx) talloc_free(ctx)
 
 /* The following definitions come from talloc.c  */
 void *_talloc(const void *context, size_t size);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091111/4aa80bda/attachment.pgp>


More information about the samba-technical mailing list