From 02c408e21a6e78ff246ea7a1beb4669634fa9c4c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 16 Jun 2022 21:50:56 +0200 Subject: Remove redundant null pointer checks before free() Per applicable standards, free() with a null pointer is a no-op. Systems that don't observe that are ancient and no longer relevant. Some PostgreSQL code already required this behavior, so this change does not introduce any new requirements, just makes the code more consistent. Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com --- src/backend/libpq/auth.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/backend/libpq/auth.c') diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index efc53f31353..2d9ab7edceb 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -2020,10 +2020,7 @@ pam_passwd_conv_proc(int num_msg, const struct pam_message **msg, fail: /* free up whatever we allocated */ for (i = 0; i < num_msg; i++) - { - if (reply[i].resp != NULL) - free(reply[i].resp); - } + free(reply[i].resp); free(reply); return PAM_CONV_ERR; -- cgit v1.2.3