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

[libvirt] [PATCH 1/3] rpc: avoid double close on error



Spotted by coverity.  If pipe2 fails, then we attempt to close
uninitialized fds, which may result in a double-close.

* src/rpc/virnetserver.c (virNetServerSignalSetup): Initialize fds.
---
 src/rpc/virnetserver.c |    2 +-
 1 file changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 2dae2ff..4deeca1 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -471,7 +471,7 @@ cleanup:

 static int virNetServerSignalSetup(virNetServerPtr srv)
 {
-    int fds[2];
+    int fds[2] = { -1, -1 };

     if (srv->sigwrite != -1)
         return 0;
-- 
1.7.4.4


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