summaryrefslogtreecommitdiff
path: root/src/bin/psql/prompt.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-01-24 19:38:49 +0000
committerNeil Conway <neilc@samurai.com>2004-01-24 19:38:49 +0000
commit610d33c1949005e9658863441f31083f9f3ceb9b (patch)
tree861eb9dfec8dc43b4f5716f48aa52d4468128a90 /src/bin/psql/prompt.c
parentcb3dc829f639801219aab4ec35e53ef924ce75c5 (diff)
This patch makes some of the memory manipulation performed by psql a
little more sane. Some parts of the code was using a static function xmalloc() that did safe memory allocation (where "safe" means "bail out on OOM"), but most of it was just invoking calloc() or malloc() directly. Now almost everything invokes xmalloc() or xcalloc().
Diffstat (limited to 'src/bin/psql/prompt.c')
-rw-r--r--src/bin/psql/prompt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index 60e82cc2c3c..c26168b099e 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.32 2004/01/20 19:49:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.33 2004/01/24 19:38:49 neilc Exp $
*/
#include "postgres_fe.h"
#include "prompt.h"
@@ -248,7 +248,7 @@ get_prompt(promptStatus_t status)
case '`':
{
FILE *fd = NULL;
- char *file = strdup(p + 1);
+ char *file = xstrdup(p + 1);
int cmdend;
cmdend = strcspn(file, "`");
@@ -274,7 +274,7 @@ get_prompt(promptStatus_t status)
const char *val;
int nameend;
- name = strdup(p + 1);
+ name = xstrdup(p + 1);
nameend = strcspn(name, ":");
name[nameend] = '\0';
val = GetVariable(pset.vars, name);