]> Sergey Matveev's repositories - nnn.git/commitdiff
Free tmp string if dirname fails
authorlostd <lostd@2f30.org>
Wed, 22 Oct 2014 14:21:53 +0000 (17:21 +0300)
committerlostd <lostd@2f30.org>
Wed, 22 Oct 2014 14:21:53 +0000 (17:21 +0300)
noice.c

diff --git a/noice.c b/noice.c
index 820b851a6e2a0be68e3603803f87c245c88c7f1a..24e687aec165ad74ec72747a1b94bb1ed103a961 100644 (file)
--- 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);