mirror of
https://github.com/jarun/nnn.git
synced 2025-03-18 20:39:45 +00:00
Free tmp string if dirname fails
This commit is contained in:
parent
9bc4b92474
commit
0809871aeb
1 changed files with 3 additions and 1 deletions
4
noice.c
4
noice.c
|
@ -128,8 +128,10 @@ 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);
|
||||||
if (p == NULL)
|
if (p == NULL) {
|
||||||
|
free(tmp);
|
||||||
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);
|
free(tmp);
|
||||||
|
|
Loading…
Add table
Reference in a new issue