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

[Xen-changelog] [xen master] libxlu: properly free buffer in PCI related functions



commit 4dcec65f7cb0db025794eeddedebf4ea5fc81d8e
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Tue Jul 28 17:23:56 2015 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Jul 29 15:26:56 2015 +0100

    libxlu: properly free buffer in PCI related functions
    
    Free buffer in both success and failure paths.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxlu_pci.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 026413b..2cd793d 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -167,17 +167,18 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci 
*pcidev, const char *str
         }
     }
 
-    free(buf2);
-
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
+    free(buf2);
+
     return 0;
 
 parse_error:
+    free(buf2);
     return ERROR_INVAL;
 }
 
@@ -246,14 +247,15 @@ int xlu_rdm_parse(XLU_Config *cfg, libxl_rdm_reserve 
*rdm, const char *str)
         }
     }
 
-    free(buf2);
-
     if (tok != ptr || state != STATE_TERMINAL)
         goto parse_error;
 
+    free(buf2);
+
     return 0;
 
 parse_error:
+    free(buf2);
     return ERROR_INVAL;
 }
 
--
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®.