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

[Xen-changelog] [xen master] libxc: fix leak in xc_dom_load_hvm_kernel error path



commit e260c1c90583c2fc3099dda6155ffa484d10ae6e
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Feb 3 11:59:57 2016 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Feb 3 11:22:13 2016 +0000

    libxc: fix leak in xc_dom_load_hvm_kernel error path

    Error path in xc_dom_load_hvm_kernel needs to use the 'error' label instead
    of directly returning. This is needed so the entries local variable is
    freed.

    Coverity-ID: 1351227
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxc/xc_dom_hvmloader.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_dom_hvmloader.c b/tools/libxc/xc_dom_hvmloader.c
index 79a3b99..330d5e8 100644
--- a/tools/libxc/xc_dom_hvmloader.c
+++ b/tools/libxc/xc_dom_hvmloader.c
@@ -257,7 +257,7 @@ static elf_errorstatus xc_dom_load_hvm_kernel(struct 
xc_dom_image *dom)
     if ( rc < 0 )
     {
         DOMPRINTF("%s: failed to load elf binary", __func__);
-        return rc;
+        goto error;
     }

     munmap(elf->dest_base, elf->dest_size);
@@ -267,14 +267,14 @@ static elf_errorstatus xc_dom_load_hvm_kernel(struct 
xc_dom_image *dom)
     if ( rc != 0 )
     {
         DOMPRINTF("%s: insufficient space to load modules.", __func__);
-        return rc;
+        goto error;
     }

     rc = loadmodules(dom, m_start, m_end, dom->guest_domid);
     if ( rc != 0 )
     {
         DOMPRINTF("%s: unable to load modules.", __func__);
-        return rc;
+        goto error;
     }

     dom->parms.phys_entry = elf_uval(elf, elf->ehdr, e_entry);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.