diff options
author | Neil Conway <neilc@samurai.com> | 2006-03-19 22:22:56 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2006-03-19 22:22:56 +0000 |
commit | a323ede2802956f115d71599514fbc01f2575dee (patch) | |
tree | 8d2bf7809a9c007563342c3dff8096e8e5acc8f5 /src/backend/utils/adt/cash.c | |
parent | 381cb046ed60a1164a244e2f9aa28b8128ea2ac5 (diff) | |
download | postgresql-a323ede2802956f115d71599514fbc01f2575dee.tar.gz postgresql-a323ede2802956f115d71599514fbc01f2575dee.zip |
Fix a few places that were checking for the return value of palloc() to be
non-NULL: palloc() ereports on OOM, so we can safely assume it returns a
valid pointer.
Diffstat (limited to 'src/backend/utils/adt/cash.c')
-rw-r--r-- | src/backend/utils/adt/cash.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index f9e2f10325a..a57cba0073a 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -9,7 +9,7 @@ * workings can be found in the book "Software Solutions in C" by * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7. * - * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.66 2005/10/15 02:49:28 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.67 2006/03/19 22:22:56 neilc Exp $ */ #include "postgres.h" @@ -291,10 +291,7 @@ cash_out(PG_FUNCTION_ARGS) /* see if we need to signify negative amount */ if (minus) { - if (!PointerIsValid(result = palloc(CASH_BUFSZ + 2 - count + strlen(nsymbol)))) - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"))); + result = palloc(CASH_BUFSZ + 2 - count + strlen(nsymbol)); /* Position code of 0 means use parens */ if (convention == 0) @@ -306,11 +303,7 @@ cash_out(PG_FUNCTION_ARGS) } else { - if (!PointerIsValid(result = palloc(CASH_BUFSZ + 2 - count))) - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"))); - + result = palloc(CASH_BUFSZ + 2 - count); strcpy(result, buf + count); } |