All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gopal Tiwari <gopalkrishna.tiwari@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, gtiwari@redhat.com
Subject: [Bluez V2 03/13] Fixing memory leak in jlink.c
Date: Tue, 31 May 2022 13:11:07 +0530	[thread overview]
Message-ID: <20220531074117.610321-4-gopalkrishna.tiwari@gmail.com> (raw)
In-Reply-To: <20220531074117.610321-1-gopalkrishna.tiwari@gmail.com>

From: Gopal Tiwari <gtiwari@redhat.com>

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

bluez-5.64/monitor/jlink.c:111: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.

bluez-5.64/monitor/jlink.c:113: leaked_storage: Variable "so"
going out of scope leaks the storage it points to.

Fixing them.

Signed-off-by: Gopal Tiwari <gtiwari@redhat.com>
---
 monitor/jlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/monitor/jlink.c b/monitor/jlink.c
index 9aaa4ebd8..f1d8ce660 100644
--- a/monitor/jlink.c
+++ b/monitor/jlink.c
@@ -107,9 +107,12 @@ int jlink_init(void)
 			!jlink.tif_select || !jlink.setspeed ||
 			!jlink.connect || !jlink.getsn ||
 			!jlink.emu_getproductname ||
-			!jlink.rtterminal_control || !jlink.rtterminal_read)
+			!jlink.rtterminal_control || !jlink.rtterminal_read) {
+		dlclose(so);
 		return -EIO;
+	}
 
+	dlclose(so);
 	return 0;
 }
 
-- 
2.26.2


  parent reply	other threads:[~2022-05-31  7:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31  7:41 [Bluez 00/13] Fixing memory leak, leaked_handle and use_after Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 01/13] Fixing memory leak issue in gatt.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 02/13] Fixing memory leakage in appkey.c Gopal Tiwari
2022-05-31  7:41 ` Gopal Tiwari [this message]
2022-05-31  7:41 ` [Bluez V2 04/13] Fixing memory leak in sixaxis.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 05/13] Fixing leaked_handle in cltest.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 06/13] Fixing leaked_handle in create-image.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 07/13] Fixing leaked_handle in l2cap-tester.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 08/13] Fixing resource leak in mesh/mesh-db.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 09/13] Fixing leaked_handle in obex-client-tool.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 10/13] Fixing use after free in src/device.c Gopal Tiwari
2022-05-31 20:22   ` Luiz Augusto von Dentz
2022-05-31  7:41 ` [Bluez V2 11/13] Fixing memory leak in pbap.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 12/13] Fixing possible use_after_free in meshctl.c Gopal Tiwari
2022-05-31  7:41 ` [Bluez V2 13/13] Fixing use_after_free in prov-db.c Gopal Tiwari
2022-05-31 20:30 ` [Bluez 00/13] Fixing memory leak, leaked_handle and use_after patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220531074117.610321-4-gopalkrishna.tiwari@gmail.com \
    --to=gopalkrishna.tiwari@gmail.com \
    --cc=gtiwari@redhat.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.