diff options
author | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2006-06-03 06:11:30 +0000 |
---|---|---|
committer | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2006-06-03 06:11:30 +0000 |
commit | 4daea919c3aa104b6caf8c0f42f49ae755545986 (patch) | |
tree | 607453f571a3451c6ba5188e010be900e6bffa1e | |
parent | 19855d6e09aa36db7686ad6f538179bf87e9c6ea (diff) |
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-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/hashtab.c | 1 |
2 files changed, 6 insertions, 0 deletions
@@ -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)); |