[PATCH 6/9] Avoid free'ing a filtered RPC message in the server

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

 



When a filter steals an RPC message, that message must
not be freed, except by the filter code itself

* src/rpc/virnetserverclient.c: Don't free stolen RPC
  messages
---
 src/rpc/virnetserverclient.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 327b121..57a3446 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -723,13 +723,17 @@ readmore:
         filter = client->filters;
         while (filter) {
             int ret = filter->func(client, msg, filter->opaque);
-            if (ret < 0 || ret > 0) {
+            if (ret < 0) {
                 virNetMessageFree(msg);
                 msg = NULL;
                 if (ret < 0)
                     client->wantClose = true;
                 break;
             }
+            if (ret > 0) {
+                msg = NULL;
+                break;
+            }
 
             filter = filter->next;
         }
-- 
1.7.4.4

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