]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix memory leak in cache
authorKarel Zak <kzak@redhat.com>
Wed, 30 Mar 2011 21:52:56 +0000 (23:52 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 30 Mar 2011 21:52:56 +0000 (23:52 +0200)
Reported-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/cache.c

index e0641c172c2f69899b6b2a5f3545535a04be7de3..18b6cd49afa9feb524a908e19c97d97271738b45 100644 (file)
@@ -457,8 +457,8 @@ char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
                p = canonicalize_path(path);
 
                if (p && cache) {
-                       native = strdup(path);
-                       real = strcmp(path, p) == 0 ? native : p;
+                       real = p;
+                       native = strcmp(path, p) == 0 ? real : strdup(path);
 
                        if (!native || !real)
                                goto error;