From 83d79a4d6c96d588ea9359fa4e01e8543eed472a Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 3 Feb 2026 09:52:22 +1100 Subject: [PATCH v2] modify mallocs in dumputils.c --- src/bin/pg_dump/dumputils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index acfa3f22cc8..5bc77fed974 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -160,7 +160,7 @@ buildACLCommands(const char *name, const char *subname, const char *nspname, * Besides, a false mismatch will just cause the output to be a little * more verbose than it really needed to be. */ - grantitems = (char **) pg_malloc(naclitems * sizeof(char *)); + grantitems = pg_malloc_array(char *, naclitems); for (i = 0; i < naclitems; i++) { bool found = false; @@ -176,7 +176,7 @@ buildACLCommands(const char *name, const char *subname, const char *nspname, if (!found) grantitems[ngrantitems++] = aclitems[i]; } - revokeitems = (char **) pg_malloc(nbaseitems * sizeof(char *)); + revokeitems = pg_malloc_array(char *, nbaseitems); for (i = 0; i < nbaseitems; i++) { bool found = false; @@ -774,8 +774,8 @@ SplitGUCList(char *rawstring, char separator, * overestimate of the number of pointers we could need. Allow one for * list terminator. */ - *namelist = nextptr = (char **) - pg_malloc((strlen(rawstring) / 2 + 2) * sizeof(char *)); + *namelist = nextptr = + pg_malloc_array(char *, (strlen(rawstring) / 2 + 2)); *nextptr = NULL; while (isspace((unsigned char) *nextp)) -- 2.47.3