]> Sergey Matveev's repositories - nnn.git/commitdiff
Only free() after xstrdup()
authorsin <sin@2f30.org>
Wed, 22 Oct 2014 14:05:14 +0000 (15:05 +0100)
committersin <sin@2f30.org>
Wed, 22 Oct 2014 14:05:14 +0000 (15:05 +0100)
noice.c

diff --git a/noice.c b/noice.c
index e804e686e188a26250e2158a1eadabf79f3d0626..37cc91db3fbfb9b96fe73f44a5271a78b09980d4 100644 (file)
--- 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;
 }