|
|
@@ -253,7 +253,7 @@ ResHash * ResHashCreate(char * name)
|
|
|
/* Create hash table */
|
|
|
pResHash = (ResHash *) malloc (sizeof(ResHash));
|
|
|
if (pResHash == NULL)
|
|
|
- return NULL;
|
|
|
+ goto error;
|
|
|
|
|
|
memset(pResHash, 0, sizeof(ResHash));
|
|
|
|
|
|
@@ -262,11 +262,26 @@ ResHash * ResHashCreate(char * name)
|
|
|
|
|
|
/* Create initial tree item and it's valuelist to hash table */
|
|
|
pResHash->treelist = (TreeNode *) malloc(sizeof(TreeNode));
|
|
|
- if (pResHash->treelist)
|
|
|
- memset(pResHash->treelist, 0, sizeof(TreeNode));
|
|
|
+ if (pResHash->treelist == NULL)
|
|
|
+ goto error;
|
|
|
+
|
|
|
+ memset(pResHash->treelist, 0, sizeof(TreeNode));
|
|
|
+
|
|
|
pResHash->treelist->vlist = (ValueNode *) malloc(sizeof(ValueNode));
|
|
|
+ if (pResHash->treelist->vlist == NULL)
|
|
|
+ goto error;
|
|
|
+
|
|
|
memset(pResHash->treelist->vlist, 0, sizeof(ValueNode));
|
|
|
|
|
|
+ goto done;
|
|
|
+
|
|
|
+error:
|
|
|
+ if (pResHash->treelist->vlist) free(pResHash->treelist->vlist);
|
|
|
+ if (pResHash->treelist) free(pResHash->treelist);
|
|
|
+ if (pResHash) free(pResHash);
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+done:
|
|
|
return pResHash;
|
|
|
}
|
|
|
|