Browse Source

path.c: use xmalloc() in add_to_trie()

Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps
and checks memory allocation result.

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Andrey Okoshkin 7 years ago committed by Junio C Hamano
parent
commit
55d7d15847
  1. 2
      path.c

2
path.c

@ -190,7 +190,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value) @@ -190,7 +190,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