From: lostd Date: Wed, 22 Oct 2014 14:21:53 +0000 (+0300) Subject: Free tmp string if dirname fails X-Git-Tag: v1.0~92^2~169 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0809871aebbdf51b0539ce70e7ff72a53cb1b2e6;p=nnn.git Free tmp string if dirname fails --- diff --git a/noice.c b/noice.c index 820b851a..24e687ae 100644 --- a/noice.c +++ b/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);