mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Only free() after xstrdup()
This commit is contained in:
parent
6d04c5329e
commit
35f3b250bb
3
noice.c
3
noice.c
|
@ -128,12 +128,11 @@ xdirname(const char *path)
|
||||||
* original string if we lose track of it. */
|
* original string if we lose track of it. */
|
||||||
tmp = xstrdup(path);
|
tmp = xstrdup(path);
|
||||||
p = dirname(tmp);
|
p = dirname(tmp);
|
||||||
free(tmp);
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
printerr(1, "dirname");
|
printerr(1, "dirname");
|
||||||
|
|
||||||
/* Make sure this is a malloc(3)-ed string */
|
/* Make sure this is a malloc(3)-ed string */
|
||||||
p = xstrdup(p);
|
p = xstrdup(p);
|
||||||
|
free(tmp);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue