aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-06-16 21:50:56 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-07-03 11:47:15 +0200
commit02c408e21a6e78ff246ea7a1beb4669634fa9c4c (patch)
tree7e4cf03f3de7e32af266b739e12c6600d871ed45 /src/interfaces/ecpg
parent098c703d308fa88dc9e3f9f623ca023ce4717794 (diff)
downloadpostgresql-02c408e21a6e78ff246ea7a1beb4669634fa9c4c.tar.gz
postgresql-02c408e21a6e78ff246ea7a1beb4669634fa9c4c.zip
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
Diffstat (limited to 'src/interfaces/ecpg')
-rw-r--r--src/interfaces/ecpg/pgtypeslib/numeric.c6
-rw-r--r--src/interfaces/ecpg/preproc/descriptor.c3
2 files changed, 2 insertions, 7 deletions
diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c
index 34efc9045f3..a97b3300cb8 100644
--- a/src/interfaces/ecpg/pgtypeslib/numeric.c
+++ b/src/interfaces/ecpg/pgtypeslib/numeric.c
@@ -16,11 +16,7 @@
#define init_var(v) memset(v,0,sizeof(numeric))
#define digitbuf_alloc(size) ((NumericDigit *) pgtypes_alloc(size))
-#define digitbuf_free(buf) \
- do { \
- if ((buf) != NULL) \
- free(buf); \
- } while (0)
+#define digitbuf_free(buf) free(buf)
/* ----------
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index 35d94711d56..f4b1878289c 100644
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -113,8 +113,7 @@ drop_descriptor(char *name, char *connection)
&& strcmp(connection, i->connection) == 0))
{
*lastptr = i->next;
- if (i->connection)
- free(i->connection);
+ free(i->connection);
free(i->name);
free(i);
return;