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>

Andrey Okoshkin committed Oct 24, 2017 at 18:15 UTC 55d7d15847e84d531f712f9fd6a7117283b208a3
1 file changed +1 -1
path.c
+1 -1
@@ -190,7 +190,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value)
190 * Split this node: child will contain this node's
191 * existing children.
192 */
193 - child = malloc(sizeof(*child));
193 + child = xmalloc(sizeof(*child));
194 memcpy(child->children, root->children, sizeof(root->children));
195
196 child->len = root->len - i - 1;