]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix memory leak [clang-analyzer]
authorKarel Zak <kzak@redhat.com>
Tue, 9 Jul 2013 12:39:49 +0000 (14:39 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 30 Jul 2013 09:15:27 +0000 (11:15 +0200)
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/utils.c

index c328414f2213eddac3b144ea86f3b2204cd3f92c..e4e515b51bd81cadbea1222d7d84c50396c4759e 100644 (file)
@@ -160,7 +160,8 @@ int mnt_chdir_to_parent(const char *target, char **filename)
                        memcpy(*filename, ".", 2);
                else
                        memcpy(*filename, last, strlen(last) + 1);
-       }
+       } else
+               free(buf);
        return 0;
 err:
        free(buf);