Commit 3272860d authored by Geoff Simmons's avatar Geoff Simmons

bugfix: check an object's magic number *before* error handling for

        a null pointer (not afterward)
parent a5daf25c
...@@ -596,14 +596,13 @@ static inline dataentry ...@@ -596,14 +596,13 @@ static inline dataentry
CHECK_OBJ_NOTNULL(de, DATA_MAGIC); CHECK_OBJ_NOTNULL(de, DATA_MAGIC);
assert(de->state == DATA_EMPTY); assert(de->state == DATA_EMPTY);
hashentry *he = hash_insert(xid, de, tim); hashentry *he = hash_insert(xid, de, tim);
CHECK_OBJ(he, HASH_MAGIC);
if (! he) { if (! he) {
LOG_Log(LOG_WARNING, "Insert: Could not insert hash for XID %d", LOG_Log(LOG_WARNING, "Insert: Could not insert hash for XID %d",
xid); xid);
data_free(de); data_free(de);
return (NULL); return (NULL);
} }
CHECK_OBJ(he, HASH_MAGIC);
/* he being filled out by Hash_Insert, we need to look after de */ /* he being filled out by Hash_Insert, we need to look after de */
de->xid = xid; de->xid = xid;
......
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