[PATCH 2/5] Fix leak of 'msg' object in client stream code

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

In one exit path we forgot to free the virNetMessage object causing
a large memory leak for streams which send alot of data. Some other
paths were calling VIR_FREE directly instead of virNetMessageFree
although this was (currently) harmless.

* src/rpc/virnetclientstream.c: Fix leak of msg object
* src/rpc/virnetclientprogram.c: Call virNetMessageFree instead
  of VIR_FREE
---
 src/rpc/virnetclientprogram.c |    4 ++--
 src/rpc/virnetclientstream.c  |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index 8414ad8..c39520a 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -329,11 +329,11 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
         goto error;
     }
 
-    VIR_FREE(msg);
+    virNetMessageFree(msg);
 
     return 0;
 
 error:
-    VIR_FREE(msg);
+    virNetMessageFree(msg);
     return -1;
 }
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index d5efab1..fe15acd 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -361,11 +361,12 @@ int virNetClientStreamSendPacket(virNetClientStreamPtr st,
     if (virNetClientSend(client, msg, wantReply) < 0)
         goto error;
 
+    virNetMessageFree(msg);
 
     return nbytes;
 
 error:
-    VIR_FREE(msg);
+    virNetMessageFree(msg);
     return -1;
 }
 
-- 
1.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]