Commit c6b1ef8f authored by Tom Lane's avatar Tom Lane

Check for malloc failure.

parent ddd96e1f
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.42 2001/03/22 03:59:57 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.43 2001/06/01 20:23:06 tgl Exp $
* *
* Note - this code is real crufty... badly needs a rewrite to improve * Note - this code is real crufty... badly needs a rewrite to improve
* readability and portability. (Shouldn't assume Oid == Index, for example) * readability and portability. (Shouldn't assume Oid == Index, for example)
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
/* /*
* private invalidation structures * private invalidation structures
*
*/ */
typedef struct InvalidationUserData typedef struct InvalidationUserData
...@@ -102,7 +101,6 @@ typedef InvalidationMessageData *InvalidationMessage; ...@@ -102,7 +101,6 @@ typedef InvalidationMessageData *InvalidationMessage;
/* /*
* variables and macros * variables and macros
*
*/ */
/* /*
...@@ -152,7 +150,6 @@ static void InvalidationMessageRegisterSharedInvalid(InvalidationMessage message ...@@ -152,7 +150,6 @@ static void InvalidationMessageRegisterSharedInvalid(InvalidationMessage message
/* /*
* InvalidationEntryAllocate * InvalidationEntryAllocate
* Allocates an invalidation entry. * Allocates an invalidation entry.
*
*/ */
static InvalidationEntry static InvalidationEntry
InvalidationEntryAllocate(uint16 size) InvalidationEntryAllocate(uint16 size)
...@@ -161,6 +158,8 @@ InvalidationEntryAllocate(uint16 size) ...@@ -161,6 +158,8 @@ InvalidationEntryAllocate(uint16 size)
entryDataP = (InvalidationEntryData *) entryDataP = (InvalidationEntryData *)
malloc(sizeof(char *) + size); /* XXX alignment */ malloc(sizeof(char *) + size); /* XXX alignment */
if (entryDataP == NULL)
elog(ERROR, "Memory exhausted in InvalidationEntryAllocate");
entryDataP->nextP = NULL; entryDataP->nextP = NULL;
return (Pointer) &entryDataP->userData; return (Pointer) &entryDataP->userData;
} }
...@@ -169,7 +168,6 @@ InvalidationEntryAllocate(uint16 size) ...@@ -169,7 +168,6 @@ InvalidationEntryAllocate(uint16 size)
* LocalInvalidRegister * LocalInvalidRegister
* Link an invalidation entry into a chain of them. Really ugly * Link an invalidation entry into a chain of them. Really ugly
* coding here. * coding here.
*
*/ */
static LocalInvalid static LocalInvalid
LocalInvalidRegister(LocalInvalid invalid, LocalInvalidRegister(LocalInvalid invalid,
...@@ -187,7 +185,6 @@ LocalInvalidRegister(LocalInvalid invalid, ...@@ -187,7 +185,6 @@ LocalInvalidRegister(LocalInvalid invalid,
* LocalInvalidInvalidate * LocalInvalidInvalidate
* Processes, then frees all entries in a local cache * Processes, then frees all entries in a local cache
* invalidation list unless freemember parameter is false. * invalidation list unless freemember parameter is false.
*
*/ */
static void static void
LocalInvalidInvalidate(LocalInvalid invalid, LocalInvalidInvalidate(LocalInvalid invalid,
...@@ -258,7 +255,6 @@ elog(DEBUG, "CacheIdRegisterLocalRollback(%d, %d, [%d, %d])", \ ...@@ -258,7 +255,6 @@ elog(DEBUG, "CacheIdRegisterLocalRollback(%d, %d, [%d, %d])", \
/* /*
* CacheIdRegisterSpecifiedLocalInvalid * CacheIdRegisterSpecifiedLocalInvalid
*
*/ */
static LocalInvalid static LocalInvalid
CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
...@@ -270,14 +266,12 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -270,14 +266,12 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* debugging stuff * debugging stuff
*
*/ */
CacheIdRegisterSpecifiedLocalInvalid_DEBUG1; CacheIdRegisterSpecifiedLocalInvalid_DEBUG1;
/* /*
* create a message describing the system catalog tuple we wish to * create a message describing the system catalog tuple we wish to
* invalidate. * invalidate.
*
*/ */
message = (InvalidationMessage) message = (InvalidationMessage)
InvalidationEntryAllocate(sizeof(InvalidationMessageData)); InvalidationEntryAllocate(sizeof(InvalidationMessageData));
...@@ -290,7 +284,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -290,7 +284,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* Add message to linked list of unprocessed messages. * Add message to linked list of unprocessed messages.
*
*/ */
invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message); invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
return invalid; return invalid;
...@@ -298,7 +291,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -298,7 +291,6 @@ CacheIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* CacheIdRegisterLocalInvalid * CacheIdRegisterLocalInvalid
*
*/ */
static void static void
CacheIdRegisterLocalInvalid(int cacheId, CacheIdRegisterLocalInvalid(int cacheId,
...@@ -308,20 +300,17 @@ CacheIdRegisterLocalInvalid(int cacheId, ...@@ -308,20 +300,17 @@ CacheIdRegisterLocalInvalid(int cacheId,
/* /*
* debugging stuff * debugging stuff
*
*/ */
CacheIdRegisterLocalInvalid_DEBUG1; CacheIdRegisterLocalInvalid_DEBUG1;
/* /*
* Add message to InvalidForall linked list. * Add message to InvalidForall linked list.
*
*/ */
InvalidForall = CacheIdRegisterSpecifiedLocalInvalid(InvalidForall, InvalidForall = CacheIdRegisterSpecifiedLocalInvalid(InvalidForall,
cacheId, hashIndex, pointer); cacheId, hashIndex, pointer);
/* /*
* Add message to InvalidLocal linked list. * Add message to InvalidLocal linked list.
*
*/ */
InvalidLocal = CacheIdRegisterSpecifiedLocalInvalid(InvalidLocal, InvalidLocal = CacheIdRegisterSpecifiedLocalInvalid(InvalidLocal,
cacheId, hashIndex, pointer); cacheId, hashIndex, pointer);
...@@ -329,7 +318,6 @@ CacheIdRegisterLocalInvalid(int cacheId, ...@@ -329,7 +318,6 @@ CacheIdRegisterLocalInvalid(int cacheId,
/* /*
* CacheIdRegisterLocalRollback * CacheIdRegisterLocalRollback
*
*/ */
static void static void
CacheIdRegisterLocalRollback(int cacheId, CacheIdRegisterLocalRollback(int cacheId,
...@@ -339,13 +327,11 @@ CacheIdRegisterLocalRollback(int cacheId, ...@@ -339,13 +327,11 @@ CacheIdRegisterLocalRollback(int cacheId,
/* /*
* debugging stuff * debugging stuff
*
*/ */
CacheIdRegisterLocalRollback_DEBUG1; CacheIdRegisterLocalRollback_DEBUG1;
/* /*
* Add message to RollbackStack linked list. * Add message to RollbackStack linked list.
*
*/ */
RollbackStack = CacheIdRegisterSpecifiedLocalInvalid( RollbackStack = CacheIdRegisterSpecifiedLocalInvalid(
RollbackStack, cacheId, hashIndex, pointer); RollbackStack, cacheId, hashIndex, pointer);
...@@ -353,7 +339,6 @@ CacheIdRegisterLocalRollback(int cacheId, ...@@ -353,7 +339,6 @@ CacheIdRegisterLocalRollback(int cacheId,
/* /*
* RelationIdRegisterSpecifiedLocalInvalid * RelationIdRegisterSpecifiedLocalInvalid
*
*/ */
static LocalInvalid static LocalInvalid
RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
...@@ -363,7 +348,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -363,7 +348,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "RelationRegisterSpecifiedLocalInvalid(%u, %u)", relationId, elog(DEBUG, "RelationRegisterSpecifiedLocalInvalid(%u, %u)", relationId,
...@@ -373,7 +357,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -373,7 +357,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* create a message describing the relation descriptor we wish to * create a message describing the relation descriptor we wish to
* invalidate. * invalidate.
*
*/ */
message = (InvalidationMessage) message = (InvalidationMessage)
InvalidationEntryAllocate(sizeof(InvalidationMessageData)); InvalidationEntryAllocate(sizeof(InvalidationMessageData));
...@@ -384,7 +367,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -384,7 +367,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* Add message to linked list of unprocessed messages. * Add message to linked list of unprocessed messages.
*
*/ */
invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message); invalid = LocalInvalidRegister(invalid, (InvalidationEntry) message);
return invalid; return invalid;
...@@ -392,7 +374,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid, ...@@ -392,7 +374,6 @@ RelationIdRegisterSpecifiedLocalInvalid(LocalInvalid invalid,
/* /*
* RelationIdRegisterLocalInvalid * RelationIdRegisterLocalInvalid
*
*/ */
static void static void
RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId) RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
...@@ -400,7 +381,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId) ...@@ -400,7 +381,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "RelationRegisterLocalInvalid(%u, %u)", relationId, elog(DEBUG, "RelationRegisterLocalInvalid(%u, %u)", relationId,
...@@ -409,14 +389,12 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId) ...@@ -409,14 +389,12 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/* /*
* Add message to InvalidForall linked list. * Add message to InvalidForall linked list.
*
*/ */
InvalidForall = RelationIdRegisterSpecifiedLocalInvalid(InvalidForall, InvalidForall = RelationIdRegisterSpecifiedLocalInvalid(InvalidForall,
relationId, objectId); relationId, objectId);
/* /*
* Add message to InvalidLocal linked list. * Add message to InvalidLocal linked list.
*
*/ */
InvalidLocal = RelationIdRegisterSpecifiedLocalInvalid(InvalidLocal, InvalidLocal = RelationIdRegisterSpecifiedLocalInvalid(InvalidLocal,
relationId, objectId); relationId, objectId);
...@@ -424,7 +402,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId) ...@@ -424,7 +402,6 @@ RelationIdRegisterLocalInvalid(Oid relationId, Oid objectId)
/* /*
* RelationIdRegisterLocalRollback * RelationIdRegisterLocalRollback
*
*/ */
static void static void
RelationIdRegisterLocalRollback(Oid relationId, Oid objectId) RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
...@@ -432,7 +409,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId) ...@@ -432,7 +409,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "RelationRegisterLocalRollback(%u, %u)", relationId, elog(DEBUG, "RelationRegisterLocalRollback(%u, %u)", relationId,
...@@ -441,7 +417,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId) ...@@ -441,7 +417,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
/* /*
* Add message to RollbackStack linked list. * Add message to RollbackStack linked list.
*
*/ */
RollbackStack = RelationIdRegisterSpecifiedLocalInvalid( RollbackStack = RelationIdRegisterSpecifiedLocalInvalid(
RollbackStack, relationId, objectId); RollbackStack, relationId, objectId);
...@@ -453,7 +428,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId) ...@@ -453,7 +428,6 @@ RelationIdRegisterLocalRollback(Oid relationId, Oid objectId)
* This routine can invalidate a tuple in a system catalog cache * This routine can invalidate a tuple in a system catalog cache
* or a cached relation descriptor. You pay your money and you * or a cached relation descriptor. You pay your money and you
* take your chances... * take your chances...
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
#define CacheIdInvalidate_DEBUG1 \ #define CacheIdInvalidate_DEBUG1 \
...@@ -472,7 +446,6 @@ CacheIdInvalidate(Index cacheId, ...@@ -472,7 +446,6 @@ CacheIdInvalidate(Index cacheId,
/* /*
* assume that if the item pointer is valid, then we are invalidating * assume that if the item pointer is valid, then we are invalidating
* an item in the specified system catalog cache. * an item in the specified system catalog cache.
*
*/ */
if (ItemPointerIsValid(pointer)) if (ItemPointerIsValid(pointer))
{ {
...@@ -485,7 +458,6 @@ CacheIdInvalidate(Index cacheId, ...@@ -485,7 +458,6 @@ CacheIdInvalidate(Index cacheId,
/* /*
* if the cacheId is the oid of any of the following system relations, * if the cacheId is the oid of any of the following system relations,
* then assume we are invalidating a relation descriptor * then assume we are invalidating a relation descriptor
*
*/ */
if (cacheId == RelOid_pg_class) if (cacheId == RelOid_pg_class)
{ {
...@@ -501,7 +473,6 @@ CacheIdInvalidate(Index cacheId, ...@@ -501,7 +473,6 @@ CacheIdInvalidate(Index cacheId,
/* /*
* Yow! the caller asked us to invalidate something else. * Yow! the caller asked us to invalidate something else.
*
*/ */
elog(FATAL, "CacheIdInvalidate: cacheId=%d relation id?", cacheId); elog(FATAL, "CacheIdInvalidate: cacheId=%d relation id?", cacheId);
} }
...@@ -512,7 +483,6 @@ CacheIdInvalidate(Index cacheId, ...@@ -512,7 +483,6 @@ CacheIdInvalidate(Index cacheId,
* This blows away all tuples in the system catalog caches and * This blows away all tuples in the system catalog caches and
* all the cached relation descriptors (and closes their files too). * all the cached relation descriptors (and closes their files too).
* Relation descriptors that have positive refcounts are then rebuilt. * Relation descriptors that have positive refcounts are then rebuilt.
*
*/ */
static void static void
ResetSystemCaches(void) ResetSystemCaches(void)
...@@ -523,7 +493,6 @@ ResetSystemCaches(void) ...@@ -523,7 +493,6 @@ ResetSystemCaches(void)
/* /*
* InvalidationMessageRegisterSharedInvalid * InvalidationMessageRegisterSharedInvalid
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
#define InvalidationMessageRegisterSharedInvalid_DEBUG1 \ #define InvalidationMessageRegisterSharedInvalid_DEBUG1 \
...@@ -575,7 +544,6 @@ InvalidationMessageRegisterSharedInvalid(InvalidationMessage message) ...@@ -575,7 +544,6 @@ InvalidationMessageRegisterSharedInvalid(InvalidationMessage message)
/* /*
* InvalidationMessageCacheInvalidate * InvalidationMessageCacheInvalidate
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
#define InvalidationMessageCacheInvalidate_DEBUG1 \ #define InvalidationMessageCacheInvalidate_DEBUG1 \
...@@ -624,7 +592,6 @@ InvalidationMessageCacheInvalidate(InvalidationMessage message) ...@@ -624,7 +592,6 @@ InvalidationMessageCacheInvalidate(InvalidationMessage message)
/* /*
* PrepareToInvalidateRelationCache * PrepareToInvalidateRelationCache
*
*/ */
static void static void
PrepareToInvalidateRelationCache(Relation relation, PrepareToInvalidateRelationCache(Relation relation,
...@@ -636,13 +603,11 @@ PrepareToInvalidateRelationCache(Relation relation, ...@@ -636,13 +603,11 @@ PrepareToInvalidateRelationCache(Relation relation,
/* /*
* get the relation object id * get the relation object id
*
*/ */
relationId = RelationGetRelid(relation); relationId = RelationGetRelid(relation);
/* /*
* is it one of the ones we need to send an SI message for? * is it one of the ones we need to send an SI message for?
*
*/ */
if (relationId == RelOid_pg_class) if (relationId == RelOid_pg_class)
objectId = tuple->t_data->t_oid; objectId = tuple->t_data->t_oid;
...@@ -653,7 +618,6 @@ PrepareToInvalidateRelationCache(Relation relation, ...@@ -653,7 +618,6 @@ PrepareToInvalidateRelationCache(Relation relation,
/* /*
* register the relcache-invalidation action in the appropriate list * register the relcache-invalidation action in the appropriate list
*
*/ */
Assert(PointerIsValid(function)); Assert(PointerIsValid(function));
...@@ -674,7 +638,6 @@ DiscardInvalid(void) ...@@ -674,7 +638,6 @@ DiscardInvalid(void)
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "DiscardInvalid called"); elog(DEBUG, "DiscardInvalid called");
...@@ -697,7 +660,6 @@ RegisterInvalid(bool send) ...@@ -697,7 +660,6 @@ RegisterInvalid(bool send)
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "RegisterInvalid(%d) called", send); elog(DEBUG, "RegisterInvalid(%d) called", send);
...@@ -705,7 +667,6 @@ RegisterInvalid(bool send) ...@@ -705,7 +667,6 @@ RegisterInvalid(bool send)
/* /*
* Process and free the current list of inval messages. * Process and free the current list of inval messages.
*
*/ */
DiscardInvalidStack(&InvalidLocal); DiscardInvalidStack(&InvalidLocal);
...@@ -741,7 +702,6 @@ ImmediateLocalInvalidation(bool send) ...@@ -741,7 +702,6 @@ ImmediateLocalInvalidation(bool send)
/* /*
* debugging stuff * debugging stuff
*
*/ */
#ifdef INVALIDDEBUG #ifdef INVALIDDEBUG
elog(DEBUG, "ImmediateLocalInvalidation(%d) called", send); elog(DEBUG, "ImmediateLocalInvalidation(%d) called", send);
...@@ -749,7 +709,6 @@ ImmediateLocalInvalidation(bool send) ...@@ -749,7 +709,6 @@ ImmediateLocalInvalidation(bool send)
/* /*
* Process and free the local list of inval messages. * Process and free the local list of inval messages.
*
*/ */
if (send) if (send)
...@@ -801,7 +760,6 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple, ...@@ -801,7 +760,6 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
/* /*
* sanity checks * sanity checks
*
*/ */
Assert(RelationIsValid(relation)); Assert(RelationIsValid(relation));
Assert(HeapTupleIsValid(tuple)); Assert(HeapTupleIsValid(tuple));
...@@ -813,14 +771,12 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple, ...@@ -813,14 +771,12 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
* We only need to worry about invalidation for tuples that are in * We only need to worry about invalidation for tuples that are in
* system relations; user-relation tuples are never in catcaches and * system relations; user-relation tuples are never in catcaches and
* can't affect the relcache either. * can't affect the relcache either.
*
*/ */
if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname))) if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
return; return;
/* /*
* debugging stuff * debugging stuff
*
*/ */
PrepareForTupleInvalidation_DEBUG1; PrepareForTupleInvalidation_DEBUG1;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.67 2001/05/18 17:49:52 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.68 2001/06/01 20:27:41 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -143,14 +143,18 @@ SetDataDir(const char *dir) ...@@ -143,14 +143,18 @@ SetDataDir(const char *dir)
} }
new = malloc(strlen(buf) + 1 + strlen(dir) + 1); new = malloc(strlen(buf) + 1 + strlen(dir) + 1);
if (!new)
elog(FATAL, "out of memory");
sprintf(new, "%s/%s", buf, dir); sprintf(new, "%s/%s", buf, dir);
free(buf); free(buf);
} }
else else
{
new = strdup(dir); new = strdup(dir);
if (!new)
elog(FATAL, "out of memory");
}
if (!new)
elog(FATAL, "out of memory");
DataDir = new; DataDir = new;
} }
...@@ -278,10 +282,15 @@ SetCharSet() ...@@ -278,10 +282,15 @@ SetCharSet()
{ {
map_file = (char *) malloc((strlen(DataDir) + map_file = (char *) malloc((strlen(DataDir) +
strlen(p) + 2) * sizeof(char)); strlen(p) + 2) * sizeof(char));
if (! map_file)
elog(FATAL, "out of memory");
sprintf(map_file, "%s/%s", DataDir, p); sprintf(map_file, "%s/%s", DataDir, p);
file = AllocateFile(map_file, PG_BINARY_R); file = AllocateFile(map_file, PG_BINARY_R);
if (file == NULL) if (file == NULL)
{
free(map_file);
return; return;
}
eof = false; eof = false;
while (!eof) while (!eof)
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.6 2001/01/24 19:01:31 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v 1.7 2001/06/01 20:29:43 tgl Exp $
*/ */
%{ %{
...@@ -324,6 +324,8 @@ GUC_scanstr(char *s) ...@@ -324,6 +324,8 @@ GUC_scanstr(char *s)
len = strlen(s); len = strlen(s);
newStr = malloc(len + 1); /* string cannot get longer */ newStr = malloc(len + 1); /* string cannot get longer */
if (newStr == NULL)
elog(FATAL, "out of memory");
for (i = 0, j = 0; i < len; i++) for (i = 0, j = 0; i < len; i++)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment