mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* darcy@druid.net
|
||||
* 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);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Joe Conway <mail@joeconway.com>
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.19 2006/03/11 04:38:29 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/fuzzystrmatch/fuzzystrmatch.c,v 1.20 2006/03/19 22:22:56 neilc Exp $
|
||||
* Copyright (c) 2001-2006, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -347,14 +347,10 @@ _metaphone(
|
||||
if (max_phonemes == 0)
|
||||
{ /* Assume largest possible */
|
||||
*phoned_word = palloc(sizeof(char) * strlen(word) +1);
|
||||
if (!*phoned_word)
|
||||
return META_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
*phoned_word = palloc(sizeof(char) * max_phonemes + 1);
|
||||
if (!*phoned_word)
|
||||
return META_ERROR;
|
||||
}
|
||||
|
||||
/*-- The first phoneme has to be processed specially. --*/
|
||||
|
Reference in New Issue
Block a user