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

[Xen-changelog] [xen master] libxc: fix leak of t_info in xc_tbuf_get_size()



commit 7c479883b04a8200fa3490ab2915b875fc4009f1
Author:     Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
AuthorDate: Fri Feb 12 16:38:32 2016 +0530
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Feb 18 11:42:59 2016 +0000

    libxc: fix leak of t_info in xc_tbuf_get_size()
    
    Avoid leaking the memory mapping of the trace buffer
    
    Coverity ID 1351228
    
    Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
    Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_tbuf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 695939a..283fbd1 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -70,11 +70,13 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned long *size)
                     sysctl.u.tbuf_op.buffer_mfn);
 
     if ( t_info == NULL || t_info->tbuf_size == 0 )
-        return -1;
+        rc = -1;
+    else
+       *size = t_info->tbuf_size;
 
-    *size = t_info->tbuf_size;
+    xenforeignmemory_unmap(xch->fmem, t_info, sysctl.u.tbuf_op.size);
 
-    return 0;
+    return rc;
 }
 
 int xc_tbuf_enable(xc_interface *xch, unsigned long pages, unsigned long *mfn,
--
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®.