Skip to content

Commit 55d7d15

Browse files
okodrongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42e6fde commit 55d7d15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void *add_to_trie(struct trie *root, const char *key, void *value)
190190
* Split this node: child will contain this node's
191191
* existing children.
192192
*/
193-
child = malloc(sizeof(*child));
193+
child = xmalloc(sizeof(*child));
194194
memcpy(child->children, root->children, sizeof(root->children));
195195

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

0 commit comments

Comments
 (0)