summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-09-17 00:47:40 +0000
committerSimo Sorce <idra@samba.org>2001-09-17 00:47:40 +0000
commite2d393bd24e5b8ae3588828113993399bb105b32 (patch)
treee4f2360767599bd1d90dfa2b8b697b88904c873d /source3/include
parentb0c3915d5e9d8b5790051ff5b3ff38d1074e423f (diff)
downloadsamba-e2d393bd24e5b8ae3588828113993399bb105b32.tar.gz
samba-e2d393bd24e5b8ae3588828113993399bb105b32.tar.bz2
samba-e2d393bd24e5b8ae3588828113993399bb105b32.zip
introduce SAFE_FREE() macro as suggested by andreas moroder.
(This used to be commit b7edd55885791f9aded11a0b0a131e02a819f374)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/smb_macros.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 52649ffc39..bf6e3c9fb9 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -37,6 +37,9 @@
#define IS_DOS_SYSTEM(test_mode) (((test_mode) & aSYSTEM) != 0)
#define IS_DOS_HIDDEN(test_mode) (((test_mode) & aHIDDEN) != 0)
+/* free memory if the pointer is valid and zero the pointer */
+#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
+
/* zero a structure */
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))