aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/cash.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2006-03-19 22:22:56 +0000
committerNeil Conway <neilc@samurai.com>2006-03-19 22:22:56 +0000
commita323ede2802956f115d71599514fbc01f2575dee (patch)
tree8d2bf7809a9c007563342c3dff8096e8e5acc8f5 /src/backend/utils/adt/cash.c
parent381cb046ed60a1164a244e2f9aa28b8128ea2ac5 (diff)
downloadpostgresql-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.c13
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);
}