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/utils/error/elog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/backend/utils/error/elog.c') diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 55ee5423afb..59124bd9ccb 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -1985,8 +1985,7 @@ set_syslog_parameters(const char *ident, int facility) closelog(); openlog_done = false; } - if (syslog_ident) - free(syslog_ident); + free(syslog_ident); syslog_ident = strdup(ident); /* if the strdup fails, we will cope in write_syslog() */ syslog_facility = facility; -- cgit v1.2.3