aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/parallel.c4
-rw-r--r--src/bin/psql/command.c7
-rw-r--r--src/bin/psql/tab-complete.c9
3 files changed, 5 insertions, 15 deletions
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index 6fe59230c5f..864c1a6daee 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -1300,7 +1300,7 @@ readMessageFromPipe(int fd)
{
/* could be any number */
bufsize += 16;
- msg = (char *) realloc(msg, bufsize);
+ msg = (char *) pg_realloc(msg, bufsize);
}
}
@@ -1308,7 +1308,7 @@ readMessageFromPipe(int fd)
* Worker has closed the connection, make sure to clean up before return
* since we are not returning msg (but did allocate it).
*/
- free(msg);
+ pg_free(msg);
return NULL;
}
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index bdf569ce35e..21cddd11ccf 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1112,12 +1112,7 @@ exec_command(const char *cmd,
while ((opt = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, false)))
{
- newval = realloc(newval, strlen(newval) + strlen(opt) + 1);
- if (!newval)
- {
- psql_error("out of memory\n");
- exit(EXIT_FAILURE);
- }
+ newval = pg_realloc(newval, strlen(newval) + strlen(opt) + 1);
strcat(newval, opt);
free(opt);
}
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 50e0ffc4330..7a8778a919a 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3820,13 +3820,8 @@ complete_from_variables(char *text, const char *prefix, const char *suffix)
if (nvars >= maxvars)
{
maxvars *= 2;
- varnames = (char **) realloc(varnames,
- (maxvars + 1) * sizeof(char *));
- if (!varnames)
- {
- psql_error("out of memory\n");
- exit(EXIT_FAILURE);
- }
+ varnames = (char **) pg_realloc(varnames,
+ (maxvars + 1) * sizeof(char *));
}
buffer = (char *) pg_malloc(strlen(ptr->name) + overhead);