[PATCH] qemu: fix memory leak in virDomainGetVcpus

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=808979

The leak is really in virProcessInfoGetAffinity, as shown in the
valgrind output given in the above bug report - it calls CPU_ALLOC(),
but then fails to call CPU_FREE().

This leak has existed in every version of libvirt since 0.7.5.
---
 src/util/processinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/util/processinfo.c b/src/util/processinfo.c
index b1b1737..af19723 100644
--- a/src/util/processinfo.c
+++ b/src/util/processinfo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2010, 2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -140,6 +140,7 @@ realloc:
     for (i = 0 ; i < maxcpu ; i++)
         if (CPU_ISSET_S(i, masklen, mask))
             VIR_USE_CPU(map, i);
+    CPU_FREE(mask);
 # else
     /* Legacy method uses a fixed size cpu mask, only allows upto 1024 cpus */
     cpu_set_t mask;
-- 
1.7.7.6

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