[PATCH] Plug a leak.

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

 



I ran valgrind via "make check" and found some leaks.
This fixes the first:

	Plug a leak.
	* src/capabilities.c (virCapabilitiesFreeGuestDomain): Free dom->type.
	(virCapabilitiesAddGuestDomain): Remove duplicate strdup stmt.

Signed-off-by: Jim Meyering <meyering@xxxxxxxxxx>
---
 src/capabilities.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/capabilities.c b/src/capabilities.c
index 263935c..2544bd3 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -73,6 +73,7 @@ virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
     for (i = 0 ; i < dom->info.nmachines ; i++)
         free(dom->info.machines[i]);
     free(dom->info.machines);
+    free(dom->type);

     free(dom);
 }
@@ -328,9 +329,6 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
     if ((dom->type = strdup(hvtype)) == NULL)
         goto no_memory;

-    if ((dom->type = strdup(hvtype)) == NULL)
-        goto no_memory;
-
     if (emulator &&
         (dom->info.emulator = strdup(emulator)) == NULL)
         goto no_memory;
--
1.5.4.3.366.g55277

--
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]