summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-03 06:11:30 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-03 06:11:30 +0000
commit4daea919c3aa104b6caf8c0f42f49ae755545986 (patch)
tree607453f571a3451c6ba5188e010be900e6bffa1e
parent19855d6e09aa36db7686ad6f538179bf87e9c6ea (diff)
downloadxorg-lib-libXpm-4daea919c3aa104b6caf8c0f42f49ae755545986.tar.gz
Always initialize atomTable to NULL, so xpmHashTableFree() doesn't try to
free a random value from the stack if xpmHashTableInit returns an error.
-rw-r--r--ChangeLog5
-rw-r--r--src/hashtab.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fd1a686..7217698 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2006-06-02 Alan Coopersmith <alan.coopersmith@sun.com>
+ * src/hashtab.c (xpmHashTableInit):
+ Always initialize atomTable to NULL, so xpmHashTableFree() doesn't
+ try to free a random value from the stack if xpmHashTableInit returns
+ an error.
+
* src/create.c (xpmParseDataAndCreate):
Coverity #1432: Returned without freeing storage "hints_cmt"
(in error case when xpmHashTableInit failed)
diff --git a/src/hashtab.c b/src/hashtab.c
index d2383a4..84f5e25 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -209,6 +209,7 @@ xpmHashTableInit(table)
table->size = INITIAL_HASH_SIZE;
table->limit = table->size / 3;
table->used = 0;
+ table->atomTable = NULL;
if (table->size >= UINT_MAX / sizeof(*atomTable))
return (XpmNoMemory);
atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable));