pathspec: fix segfault in clear_pathspec
[gitweb.git] / worktree.c
index d633761575bff4811fa4f3f3822807b1f77f5ecb..d7b911aac730001b466379c26faa390fb21a5bfb 100644 (file)
@@ -175,7 +175,7 @@ struct worktree **get_worktrees(unsigned flags)
        struct dirent *d;
        int counter = 0, alloc = 2;
 
-       list = xmalloc(alloc * sizeof(struct worktree *));
+       ALLOC_ARRAY(list, alloc);
 
        list[counter++] = get_main_worktree();