summaryrefslogtreecommitdiffstats
path: root/source/include/talloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/include/talloc.h')
-rw-r--r--source/include/talloc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/include/talloc.h b/source/include/talloc.h
index 89c2f82e056..ee0c943c51f 100644
--- a/source/include/talloc.h
+++ b/source/include/talloc.h
@@ -32,4 +32,9 @@ typedef struct {
size_t total_alloc_size;
} TALLOC_CTX;
+/* free memory if the pointer is valid and zero the pointer */
+#ifndef SAFE_FREE
+#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+#endif
+
#endif