From: sin Date: Wed, 22 Oct 2014 14:05:14 +0000 (+0100) Subject: Only free() after xstrdup() X-Git-Tag: v1.0~92^2~171 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=35f3b250bb1e218a46da9e6287f31fb5aeaa3f62;p=nnn.git Only free() after xstrdup() --- diff --git a/noice.c b/noice.c index e804e686..37cc91db 100644 --- a/noice.c +++ b/noice.c @@ -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; }