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;
struct strbuf path = STRBUF_INIT;
if (is_main_worktree(wt))
- die("BUG: can't relocate main worktree");
+ BUG("can't relocate main worktree");
strbuf_realpath(&path, path_, 1);
if (fspathcmp(wt->path, path.buf)) {