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

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



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


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