libmount: fix memleak in mnt_pretty_path()

References: https://github.com/karelzak/util-linux/issues/275
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-02-12 13:09:28 +01:00
parent d0fe12aeb4
commit af86564357
1 changed files with 1 additions and 0 deletions

View File

@ -635,6 +635,7 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache)
if (loopcxt_is_autoclear(&lc)) {
char *tmp = loopcxt_get_backing_file(&lc);
if (tmp) {
loopcxt_deinit(&lc);
if (!cache)
free(pretty); /* not cached, deallocate */
return tmp; /* return backing file */