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

[libvirt] [PATCH] Fix more reference leaks for node devices



Reported by Chris Lalancette, I just found more instances
of the same pattern.
---
 daemon/remote.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index ec5f85b..cb9e83d 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -5126,10 +5126,12 @@ remoteDispatchNodeDeviceDettach (struct qemud_server *server ATTRIBUTE_UNUSED,
     }
 
     if (virNodeDeviceDettach(dev) == -1) {
+        virNodeDeviceFree(dev);
         remoteDispatchConnError(rerr, conn);
         return -1;
     }
 
+    virNodeDeviceFree(dev);
     return 0;
 }
 
@@ -5153,10 +5155,12 @@ remoteDispatchNodeDeviceReAttach (struct qemud_server *server ATTRIBUTE_UNUSED,
     }
 
     if (virNodeDeviceReAttach(dev) == -1) {
+        virNodeDeviceFree(dev);
         remoteDispatchConnError(rerr, conn);
         return -1;
     }
 
+    virNodeDeviceFree(dev);
     return 0;
 }
 
@@ -5180,10 +5184,12 @@ remoteDispatchNodeDeviceReset (struct qemud_server *server ATTRIBUTE_UNUSED,
     }
 
     if (virNodeDeviceReset(dev) == -1) {
+        virNodeDeviceFree(dev);
         remoteDispatchConnError(rerr, conn);
         return -1;
     }
 
+    virNodeDeviceFree(dev);
     return 0;
 }
 
@@ -5230,10 +5236,12 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
     }
 
     if (virNodeDeviceDestroy(dev) == -1) {
+        virNodeDeviceFree(dev);
         remoteDispatchConnError(rerr, conn);
         return -1;
     }
 
+    virNodeDeviceFree(dev);
     return 0;
 }
 
-- 
1.7.0.4


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