diff options
author | Neil Conway | 2006-03-19 22:22:56 +0000 |
---|---|---|
committer | Neil Conway | 2006-03-19 22:22:56 +0000 |
commit | a323ede2802956f115d71599514fbc01f2575dee (patch) | |
tree | 8d2bf7809a9c007563342c3dff8096e8e5acc8f5 /contrib/chkpass/chkpass.c | |
parent | 381cb046ed60a1164a244e2f9aa28b8128ea2ac5 (diff) |
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 'contrib/chkpass/chkpass.c')
-rw-r--r-- | contrib/chkpass/chkpass.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/contrib/chkpass/chkpass.c b/contrib/chkpass/chkpass.c index 8b77fb2a3a0..e20164eed2b 100644 --- a/contrib/chkpass/chkpass.c +++ b/contrib/chkpass/chkpass.c @@ -4,7 +4,7 @@ * http://www.druid.net/darcy/ * - * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.14 2005/10/15 02:49:04 momjian Exp $ + * $PostgreSQL: pgsql/contrib/chkpass/chkpass.c,v 1.15 2006/03/19 22:22:55 neilc Exp $ * best viewed with tabs set to 4 */ @@ -108,11 +108,9 @@ chkpass_out(PG_FUNCTION_ARGS) chkpass *password = (chkpass *) PG_GETARG_POINTER(0); char *result; - if ((result = (char *) palloc(16)) != NULL) - { - result[0] = ':'; - strcpy(result + 1, password->password); - } + result = (char *) palloc(16); + result[0] = ':'; + strcpy(result + 1, password->password); PG_RETURN_CSTRING(result); } @@ -129,11 +127,9 @@ chkpass_rout(PG_FUNCTION_ARGS) chkpass *password = (chkpass *) PG_GETARG_POINTER(0); text *result; - if ((result = (text *) palloc(VARHDRSZ + 16)) != NULL) - { - result->vl_len = VARHDRSZ + strlen(password->password); - memcpy(result->vl_dat, password->password, strlen(password->password)); - } + result = (text *) palloc(VARHDRSZ + 16); + result->vl_len = VARHDRSZ + strlen(password->password); + memcpy(result->vl_dat, password->password, strlen(password->password)); PG_RETURN_TEXT_P(result); } |