1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-13 16:23:50 +03:00

introduce SAFE_FREE() macro as suggested by andreas moroder.

This commit is contained in:
Simo Sorce
-
parent 5b369bce69
commit b7edd55885
2 changed files with 24 additions and 25 deletions

View File

@@ -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))