summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_archivecleanup/pg_archivecleanup.c2
-rw-r--r--src/bin/psql/command.c12
2 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 2b3d15dd58..319038fc80 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -314,7 +314,7 @@ main(int argc, char **argv)
dryrun = true;
break;
case 'x':
- additional_ext = strdup(optarg); /* Extension to remove
+ additional_ext = pg_strdup(optarg); /* Extension to remove
* from xlogfile names */
break;
default:
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 38038d415f..a9a2fdbf26 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1182,15 +1182,23 @@ exec_command(const char *cmd,
fflush(stdout);
}
result = gets_fromFile(stdin);
+ if (!result)
+ {
+ psql_error("\\%s: could not read value for variable\n",
+ cmd);
+ success = false;
+ }
}
- if (!SetVariable(pset.vars, opt, result))
+ if (result &&
+ !SetVariable(pset.vars, opt, result))
{
psql_error("\\%s: error while setting variable\n", cmd);
success = false;
}
- free(result);
+ if (result)
+ free(result);
if (prompt_text)
free(prompt_text);
free(opt);