Merge branch 'pk/rebase-in-c-2-basic'
[gitweb.git] / worktree.c
index 97cda5f97bbc10b2f5690b945ab42d2beef74e2e..b0d0b5426da0d1cbe8d7b6ff569c7511569cf0a3 100644 (file)
@@ -217,7 +217,11 @@ struct worktree *find_worktree(struct worktree **list,
 
        if (prefix)
                arg = to_free = prefix_filename(prefix, arg);
-       path = real_pathdup(arg, 1);
+       path = real_pathdup(arg, 0);
+       if (!path) {
+               free(to_free);
+               return NULL;
+       }
        for (; *list; list++)
                if (!fspathcmp(path, real_path((*list)->path)))
                        break;