/* This frees to if we're supposed to take it. */
cto = path_canon(tmpctx, to);
- if (!cto)
+ if (!cto) {
+ ret = NULL;
goto out;
+ }
/* How much is in common? */
for (common = i = 0; cfrom[i] && cto[i]; i++) {
goto fail;
}
- ret[len] = '\0';
+ if (ret)
+ ret[len] = '\0';
+
out:
if (taken(linkname))
tal_free(linkname);