aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/pg_ctl.c3
-rw-r--r--src/bin/pg_dump/dumputils.c12
-rw-r--r--src/bin/pg_test_fsync/pg_test_fsync.c2
-rw-r--r--src/bin/pg_waldump/pg_waldump.c10
-rw-r--r--src/bin/psql/large_obj.c2
5 files changed, 14 insertions, 15 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index febb076ee6f..400763dea78 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -1979,7 +1979,8 @@ GetPrivilegesToDelete(HANDLE hToken)
return NULL;
}
- tokenPrivs = (PTOKEN_PRIVILEGES) malloc(length);
+ tokenPrivs = (PTOKEN_PRIVILEGES) pg_malloc_extended(length,
+ MCXT_ALLOC_NO_OOM);
if (tokenPrivs == NULL)
{
write_stderr(_("%s: out of memory\n"), progname);
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c
index 65e221157b3..67691eb57a8 100644
--- a/src/bin/pg_dump/dumputils.c
+++ b/src/bin/pg_dump/dumputils.c
@@ -481,15 +481,13 @@ parseAclItem(const char *item, const char *type,
char *slpos;
char *pos;
- buf = strdup(item);
- if (!buf)
- return false;
+ buf = pg_strdup(item);
/* user or group name is string up to = */
eqpos = copyAclUserName(grantee, buf);
if (*eqpos != '=')
{
- free(buf);
+ pg_free(buf);
return false;
}
@@ -501,13 +499,13 @@ parseAclItem(const char *item, const char *type,
slpos = copyAclUserName(grantor, slpos);
if (*slpos != '\0')
{
- free(buf);
+ pg_free(buf);
return false;
}
}
else
{
- free(buf);
+ pg_free(buf);
return false;
}
@@ -617,7 +615,7 @@ do { \
appendPQExpBuffer(privs, "(%s)", subname);
}
- free(buf);
+ pg_free(buf);
return true;
}
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index f7021017429..83771061a46 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -170,7 +170,7 @@ handle_args(int argc, char *argv[])
switch (option)
{
case 'f':
- filename = strdup(optarg);
+ filename = pg_strdup(optarg);
break;
case 's':
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index e106fb2ed1e..f61505ade36 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -247,7 +247,7 @@ identify_target_directory(XLogDumpPrivate *private, char *directory,
{
if (search_directory(directory, fname))
{
- private->inpath = strdup(directory);
+ private->inpath = pg_strdup(directory);
return;
}
@@ -255,7 +255,7 @@ identify_target_directory(XLogDumpPrivate *private, char *directory,
snprintf(fpath, MAXPGPATH, "%s/%s", directory, XLOGDIR);
if (search_directory(fpath, fname))
{
- private->inpath = strdup(fpath);
+ private->inpath = pg_strdup(fpath);
return;
}
}
@@ -266,13 +266,13 @@ identify_target_directory(XLogDumpPrivate *private, char *directory,
/* current directory */
if (search_directory(".", fname))
{
- private->inpath = strdup(".");
+ private->inpath = pg_strdup(".");
return;
}
/* XLOGDIR */
if (search_directory(XLOGDIR, fname))
{
- private->inpath = strdup(XLOGDIR);
+ private->inpath = pg_strdup(XLOGDIR);
return;
}
@@ -283,7 +283,7 @@ identify_target_directory(XLogDumpPrivate *private, char *directory,
snprintf(fpath, MAXPGPATH, "%s/%s", datadir, XLOGDIR);
if (search_directory(fpath, fname))
{
- private->inpath = strdup(fpath);
+ private->inpath = pg_strdup(fpath);
return;
}
}
diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c
index c12f4326e32..cecb4897f5a 100644
--- a/src/bin/psql/large_obj.c
+++ b/src/bin/psql/large_obj.c
@@ -200,7 +200,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg)
char *bufptr;
size_t slen = strlen(comment_arg);
- cmdbuf = malloc(slen * 2 + 256);
+ cmdbuf = pg_malloc_extended(slen * 2 + 256, MCXT_ALLOC_NO_OOM);
if (!cmdbuf)
return fail_lo_xact("\\lo_import", own_transaction);
sprintf(cmdbuf, "COMMENT ON LARGE OBJECT %u IS '", loid);