aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 1cb30088c48..179c1622793 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -60,6 +60,9 @@ pg_malloc(size_t size)
{
void *tmp;
+ /* Avoid unportable behavior of malloc(0) */
+ if (size == 0)
+ size = 1;
tmp = malloc(size);
if (!tmp)
{