Merge branch 'ao/path-use-xmalloc'
A possible oom error is now caught as a fatal error, instead of continuing and dereferencing NULL. * ao/path-use-xmalloc: path.c: use xmalloc() in add_to_trie()
This commit is contained in:
2
path.c
2
path.c
@ -192,7 +192,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value)
|
|||||||
* Split this node: child will contain this node's
|
* Split this node: child will contain this node's
|
||||||
* existing children.
|
* existing children.
|
||||||
*/
|
*/
|
||||||
child = malloc(sizeof(*child));
|
child = xmalloc(sizeof(*child));
|
||||||
memcpy(child->children, root->children, sizeof(root->children));
|
memcpy(child->children, root->children, sizeof(root->children));
|
||||||
|
|
||||||
child->len = root->len - i - 1;
|
child->len = root->len - i - 1;
|
||||||
|
Reference in New Issue
Block a user