[PATCH] Fix some memory leaks in xs_internal.c

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

 



Hi

Some memory releases is missed in xs_internal.c.
This patch fixes it.

Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx>

Thanks,
Masayuki Sunou.

----------------------------------------------------------------------
Index: src/xs_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xs_internal.c,v
retrieving revision 1.47
diff -u -p -r1.47 xs_internal.c
--- src/xs_internal.c	10 Aug 2007 18:25:15 -0000	1.47
+++ src/xs_internal.c	17 Aug 2007 05:19:00 -0000
@@ -578,6 +578,8 @@ xenStoreListDomains(virConnectPtr conn, 
 #endif
 	ids[ret++] = (int) id;
     }
+    if (idlist)
+        free(idlist);
     return(ret);
 }
 
@@ -637,11 +639,10 @@ xenStoreLookupByName(virConnectPtr conn,
     path = xs_get_domain_path(priv->xshandle, (unsigned int) id);
 
     if (!found)
-        return(NULL);
+        goto done;
 
     ret = virGetDomain(conn, name, NULL);
     if (ret == NULL) {
-        if (path != NULL) free(path);
         goto done;
     }
     ret->id = id;
@@ -651,6 +652,8 @@ done:
 	free(xenddomain);
     if (idlist != NULL)
 	free(idlist);
+    if (path != NULL)
+        free(path);
 
     return(ret);
 }
----------------------------------------------------------------------

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]