2022-05-30 13:26:18

by Gopal Tiwari

[permalink] [raw]
Subject: [Bluez 09/13] Fixing leaked_handle in obex-client-tool.c

From: Gopal Tiwari <[email protected]>

While performing static tool analysis using coverity found following reports for resouse leak

bluez-5.64/tools/obex-client-tool.c:315: leaked_handle: Handle variable "sk" going out of scope leaks the handle.

Signed-off-by: Gopal Tiwari <[email protected]>
---
tools/obex-client-tool.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/obex-client-tool.c b/tools/obex-client-tool.c
index ab9332896..cb0e41247 100644
--- a/tools/obex-client-tool.c
+++ b/tools/obex-client-tool.c
@@ -312,6 +312,7 @@ static GIOChannel *unix_connect(GObexTransportType transport)
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
err = errno;
g_printerr("connect: %s (%d)\n", strerror(err), err);
+ close(sk);
return NULL;
}

--
2.26.2