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(a)redhat.com>
---
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