Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From b8bc6bfdb5e7fb5b46d3a830e04632939bee6b98 Mon Sep 17 00:00:00 2001 |
| 2 | From: Catalin Enache <catalin.enache@windriver.com> |
| 3 | Date: Fri, 9 Feb 2018 16:35:11 +0200 |
| 4 | Subject: [PATCH] saHpiSessionClose: close socket |
| 5 | |
| 6 | saHpiSessionClose leaks file descriptors |
| 7 | |
| 8 | Upstream issue: https://github.com/open-hpi/openhpi/issues/1918 |
| 9 | |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | Signed-off-by: Catalin Enache <catalin.enache@windriver.com> |
| 13 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> |
| 14 | --- |
| 15 | baselib/session.cpp | 6 ++++++ |
| 16 | 1 file changed, 6 insertions(+) |
| 17 | |
| 18 | diff --git a/baselib/session.cpp b/baselib/session.cpp |
| 19 | index c5edfc8..4ece1b7 100644 |
| 20 | --- a/baselib/session.cpp |
| 21 | +++ b/baselib/session.cpp |
| 22 | @@ -126,6 +126,12 @@ cSession::cSession() |
| 23 | |
| 24 | cSession::~cSession() |
| 25 | { |
| 26 | + cClientStreamSock * sock; |
| 27 | + gpointer ptr = wrap_g_static_private_get( &m_sockets ); |
| 28 | + if ( ptr ) { |
| 29 | + sock = reinterpret_cast<cClientStreamSock *>(ptr); |
| 30 | + sock->Close(); |
| 31 | + } |
| 32 | wrap_g_static_private_free( &m_sockets ); |
| 33 | } |
| 34 | |
| 35 | -- |
| 36 | 2.10.2 |
| 37 | |