talloc: avoid a function call in TALLOC_FREE() if possible.
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Dec 2013 14:35:37 +0000 (15:35 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 16 May 2014 15:21:04 +0000 (17:21 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/talloc/talloc.h

index 5d29a8d5cf050f9ec5d4f16e81885e6437e6b9ee..0d47d23b2ff570db1ff0d5e6ef1cf389c4e8fc64 100644 (file)
@@ -893,7 +893,7 @@ void *_talloc_pooled_object(const void *ctx,
  *
  * @param[in]  ctx      The chunk to be freed.
  */
-#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)
+#define TALLOC_FREE(ctx) do { if (ctx != NULL) { talloc_free(ctx); ctx=NULL; } } while(0)
 
 /* @} ******************************************************************/