/* 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);
char **path_split(const tal_t *ctx, const char *path)
{
bool empty = path && !path[0];
- char **ret = strsplit(ctx, path, PATH_SEP_STR, STR_NO_EMPTY);
+ char **ret = tal_strsplit(ctx, path, PATH_SEP_STR, STR_NO_EMPTY);
/* Handle the "/" case */
if (ret && !empty && !ret[0]) {