mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +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. */
|
||||
tmp = xstrdup(path);
|
||||
p = dirname(tmp);
|
||||
if (p == NULL)
|
||||
if (p == NULL) {
|
||||
free(tmp);
|
||||
printerr(1, "dirname");
|
||||
}
|
||||
/* Make sure this is a malloc(3)-ed string */
|
||||
p = xstrdup(p);
|
||||
free(tmp);
|
||||
|
|
Loading…
Add table
Reference in a new issue