Only free() after xstrdup()

This commit is contained in:
sin 2014-10-22 15:05:14 +01:00
parent 6d04c5329e
commit 35f3b250bb
1 changed files with 1 additions and 2 deletions

View File

@ -128,12 +128,11 @@ xdirname(const char *path)
* original string if we lose track of it. */
tmp = xstrdup(path);
p = dirname(tmp);
free(tmp);
if (p == NULL)
printerr(1, "dirname");
/* Make sure this is a malloc(3)-ed string */
p = xstrdup(p);
free(tmp);
return p;
}