aboutsummaryrefslogtreecommitdiff
path: root/libpam/include
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-12-14 08:00:00 +0000
committerDmitry V. Levin <ldv@strace.io>2023-12-14 08:00:00 +0000
commit954234f0a477636eab751a6601d34bab1db41b0e (patch)
tree83403cf711c78b112e2738eb82b35d801cce18ee /libpam/include
parent297f0b554e497e95c891fd6a77f7ac5591649f26 (diff)
downloadpam-954234f0a477636eab751a6601d34bab1db41b0e.tar.gz
pam-954234f0a477636eab751a6601d34bab1db41b0e.tar.bz2
pam-954234f0a477636eab751a6601d34bab1db41b0e.zip
treewide: assume free(NULL) is no-op
The C standard guarantees that if the argument of free() is a null pointer, no action occurs.
Diffstat (limited to 'libpam/include')
-rw-r--r--libpam/include/security/_pam_macros.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/libpam/include/security/_pam_macros.h b/libpam/include/security/_pam_macros.h
index 8044e451..e36f4023 100644
--- a/libpam/include/security/_pam_macros.h
+++ b/libpam/include/security/_pam_macros.h
@@ -44,10 +44,8 @@ do { \
#define _pam_drop(X) \
do { \
- if (X) { \
- free(X); \
- X=NULL; \
- } \
+ free(X); \
+ X=NULL; \
} while (0)
/*
@@ -64,8 +62,7 @@ do { \
free(reply[reply_i].resp); \
} \
} \
- if (reply) \
- free(reply); \
+ free(reply); \
} while (0)
/* some debugging code */