aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-06-01 19:54:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-06-01 19:54:58 +0000
commitd8adce898314b44312b9a9f625e2a7cb3ed42600 (patch)
tree90b0990062eac180e329d1374ff922e5b00cc47f /src
parent25ee08e14a181fea4629b27f7dbbc8ffb6da7c02 (diff)
downloadpostgresql-d8adce898314b44312b9a9f625e2a7cb3ed42600.tar.gz
postgresql-d8adce898314b44312b9a9f625e2a7cb3ed42600.zip
Check for malloc failure.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/sequence.c9
-rw-r--r--src/backend/lib/dllist.c6
2 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index f37b6199b24..d5437afa73a 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.56 2001/05/27 09:59:29 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.57 2001/06/01 19:52:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -646,8 +646,11 @@ init_sequence(char *caller, char *name)
* as the backend does, so we use plain malloc for them.
*/
elm = (SeqTable) malloc(sizeof(SeqTableData));
- elm->name = malloc(strlen(name) + 1);
- strcpy(elm->name, name);
+ if (elm == NULL)
+ elog(ERROR, "Memory exhausted in init_sequence");
+ elm->name = strdup(name);
+ if (elm->name == NULL)
+ elog(ERROR, "Memory exhausted in init_sequence");
elm->rel = seqrel;
elm->relid = RelationGetRelid(seqrel);
elm->cached = elm->last = elm->increment = 0;
diff --git a/src/backend/lib/dllist.c b/src/backend/lib/dllist.c
index 9f2135cc9ad..6f88bfea257 100644
--- a/src/backend/lib/dllist.c
+++ b/src/backend/lib/dllist.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.21 2001/02/10 02:31:26 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.22 2001/06/01 19:54:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,8 @@ DLNewList(void)
Dllist *l;
l = (Dllist *) malloc(sizeof(Dllist));
+ if (l == NULL)
+ elog(ERROR, "Memory exhausted in DLNewList");
l->dll_head = 0;
l->dll_tail = 0;
@@ -66,6 +68,8 @@ DLNewElem(void *val)
Dlelem *e;
e = (Dlelem *) malloc(sizeof(Dlelem));
+ if (e == NULL)
+ elog(ERROR, "Memory exhausted in DLNewElem");
e->dle_next = 0;
e->dle_prev = 0;
e->dle_val = val;