summaryrefslogtreecommitdiff
path: root/src/bin/psql/stringutils.c
diff options
context:
space:
mode:
authorNeil Conway2004-01-24 19:38:49 +0000
committerNeil Conway2004-01-24 19:38:49 +0000
commit70bf859194e672b309f01960d079caefd0f61e2b (patch)
tree7ff60e31eae7114b14909af4feb205758f418aa2 /src/bin/psql/stringutils.c
parentc64eff758f9212dd213413db59bef2bfe58a8549 (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/stringutils.c')
-rw-r--r--src/bin/psql/stringutils.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c
index ab6de4d9a7..783044acef 100644
--- a/src/bin/psql/stringutils.c
+++ b/src/bin/psql/stringutils.c
@@ -77,9 +77,7 @@ strtokx(const char *s,
* tokens. 2X the space is a gross overestimate, but it's
* unlikely that this code will be used on huge strings anyway.
*/
- storage = (char *) malloc(2 * strlen(s) + 1);
- if (!storage)
- return NULL; /* really "out of memory" */
+ storage = xmalloc(2 * strlen(s) + 1);
strcpy(storage, s);
string = storage;
}