[PATCH] fix memory leak in virCopyLastError

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

 



memset before virResetError will cause memory leak.

virResetError and virCopyError, which calls virResetError, will do
memset properly, so we don't have to worry about it here.

---
 src/util/virterror.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/src/util/virterror.c b/src/util/virterror.c
index 7caa69e..46afd37 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -276,8 +276,6 @@ int
 virCopyLastError(virErrorPtr to)
 {
     virErrorPtr err = virLastErrorObject();
-    /* We can't guarantee caller has initialized it to zero */
-    memset(to, 0, sizeof(*to));
     if (err)
         virCopyError(err, to);
     else
-- 
1.7.10.2

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