Browse Source

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()
maint
Junio C Hamano 7 years ago
parent
commit
fd052e4f9a
  1. 2
      path.c

2
path.c

@ -192,7 +192,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value) @@ -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
* existing children.
*/
child = malloc(sizeof(*child));
child = xmalloc(sizeof(*child));
memcpy(child->children, root->children, sizeof(root->children));

child->len = root->len - i - 1;

Loading…
Cancel
Save