difftool: handle unmerged files in dir-diff mode
[gitweb.git] / builtin / worktree.c
index 20cf67a549b0d293f42e7f7c21f8822d06aa9c7c..38b56096bd3b914d1128e0bebb5c964a3cdd1b74 100644 (file)
@@ -52,7 +52,7 @@ static int prune_worktree(const char *id, struct strbuf *reason)
                return 1;
        }
        len = st.st_size;
-       path = xmalloc(len + 1);
+       path = xmallocz(len);
        read_in_full(fd, path, len);
        close(fd);
        while (len && (path[len - 1] == '\n' || path[len - 1] == '\r'))