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

[xen master] vchan-socket-proxy: Cleanup resources on exit



commit d20c0f1a7864a38b6c26d11d0e44467fba118625
Author:     Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Wed Jun 10 23:29:35 2020 -0400
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Fri Jun 26 12:00:02 2020 +0000

    vchan-socket-proxy: Cleanup resources on exit
    
    Close open FDs and close th vchan connection when exiting the program.
    
    This addresses some Coverity findings about leaking file descriptors.
    
    Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Release-acked-by: Paul Durrant <paul@xxxxxxx>
---
 tools/libvchan/vchan-socket-proxy.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libvchan/vchan-socket-proxy.c 
b/tools/libvchan/vchan-socket-proxy.c
index cd7629bc4e..3552783ec2 100644
--- a/tools/libvchan/vchan-socket-proxy.c
+++ b/tools/libvchan/vchan-socket-proxy.c
@@ -518,5 +518,14 @@ int main(int argc, char **argv)
         }
     }
 
+    if (state.output_fd >= 0)
+        close(state.output_fd);
+    if (state.input_fd >= 0)
+        close(state.input_fd);
+    if (state.ctrl)
+        libxenvchan_close(state.ctrl);
+    if (socket_fd >= 0)
+        close(socket_fd);
+
     return ret;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.