[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen-traditional stable-4.6] block-vvfat: fix resource leaks in read_directory()



commit bc00cad75d8bcc3ba696992bec219c21db8406aa
Author:     Yunlei Ding <yunlei.ding@xxxxxxxxxx>
AuthorDate: Tue Mar 11 10:19:23 2014 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Oct 16 16:52:07 2015 +0100

    block-vvfat: fix resource leaks in read_directory()
    
    Signed-off-by: Yunlei Ding <yunlei.ding@xxxxxxxxxx>
    Coverity-IDs: 1055920 1055921
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 block-vvfat.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/block-vvfat.c b/block-vvfat.c
index 6cd57a2..ff5c8bf 100644
--- a/block-vvfat.c
+++ b/block-vvfat.c
@@ -760,6 +760,7 @@ static int read_directory(BDRVVVFATState* s, int 
mapping_index)
         if (st.st_size > 0x7fffffff) {
            fprintf(stderr, "File %s is larger than 2GB\n", buffer);
            free(buffer);
+            closedir(dir);
            return -2;
         }
        direntry->size=cpu_to_le32(S_ISDIR(st.st_mode)?0:st.st_size);
@@ -787,6 +788,8 @@ static int read_directory(BDRVVVFATState* s, int 
mapping_index)
            s->current_mapping->read_only =
                (st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
        }
+        else
+            qemu_free(buffer);
     }
     closedir(dir);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-traditional.git#stable-4.6

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.