]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block/vvfat: Plug memory leak in read_directory()
authorMarkus Armbruster <armbru@redhat.com>
Wed, 28 May 2014 09:17:05 +0000 (11:17 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Jul 2014 21:31:29 +0000 (16:31 -0500)
Has always been leaky.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit b122c3b6d020e529b203836efb8f611ece787293)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/vvfat.c

index e71d71ead8ae6625009082a573ffcc8a498443cc..e9e4fad44dd567a7d9509a84cc8af7338eae1be8 100644 (file)
@@ -788,7 +788,9 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
            s->current_mapping->path=buffer;
            s->current_mapping->read_only =
                (st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
-       }
+        } else {
+            g_free(buffer);
+        }
     }
     closedir(dir);