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

[libvirt] [PATCH] fix memory leak in virCopyLastError



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


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