Fix a memory leak if parent directory creation failed.
[oweals/busybox.git] / libbb / concat_path_file.c
index c699a84f7e57376321eb5374560d3d64401271cd..86dd2fbbf8678feac063a31e5f91d100cc1881e4 100644 (file)
@@ -17,7 +17,7 @@ extern char *concat_path_file(const char *path, const char *filename)
        if (!path)
            path="";
        lc = last_char_is(path, '/');
-       if (filename[0] == '/')
+       while (*filename == '/')
                filename++;
        outbuf = xmalloc(strlen(path)+strlen(filename)+1+(lc==NULL));
        sprintf(outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);