linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] storage: Fix memory leak
@ 2013-01-04  5:42 Jaganath Kanakkassery
  2013-01-04  5:42 ` [PATCH 2/2] rfkill: Fix count parameter in read Jaganath Kanakkassery
  2013-01-04 14:17 ` [PATCH 1/2] storage: Fix memory leak Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Jaganath Kanakkassery @ 2013-01-04  5:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery

If bt_uuid2string() returns NULL then svcclass has to be freed
---
 src/storage.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/storage.c b/src/storage.c
index 375974a..be3bbf2 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -180,8 +180,10 @@ sdp_record_t *find_record_in_list(sdp_list_t *recs, const char *uuid)
 
 		/* Extract the uuid */
 		uuid_str = bt_uuid2string(svcclass->data);
-		if (!uuid_str)
+		if (!uuid_str) {
+			sdp_list_free(svcclass, free);
 			continue;
+		}
 
 		if (!strcasecmp(uuid_str, uuid)) {
 			sdp_list_free(svcclass, free);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] rfkill: Fix count parameter in read
  2013-01-04  5:42 [PATCH 1/2] storage: Fix memory leak Jaganath Kanakkassery
@ 2013-01-04  5:42 ` Jaganath Kanakkassery
  2013-01-04 14:17 ` [PATCH 1/2] storage: Fix memory leak Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Jaganath Kanakkassery @ 2013-01-04  5:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery

Since g_str_has_prefix() has been used with the output buffer of read
it should be NULL terminated
---
 src/rfkill.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rfkill.c b/src/rfkill.c
index bac9efd..51591cb 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -114,7 +114,7 @@ static gboolean rfkill_event(GIOChannel *chan,
 
 	memset(sysname, 0, sizeof(sysname));
 
-	if (read(fd, sysname, sizeof(sysname)) < 4) {
+	if (read(fd, sysname, sizeof(sysname) - 1) < 4) {
 		close(fd);
 		return TRUE;
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] storage: Fix memory leak
  2013-01-04  5:42 [PATCH 1/2] storage: Fix memory leak Jaganath Kanakkassery
  2013-01-04  5:42 ` [PATCH 2/2] rfkill: Fix count parameter in read Jaganath Kanakkassery
@ 2013-01-04 14:17 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2013-01-04 14:17 UTC (permalink / raw)
  To: Jaganath Kanakkassery; +Cc: linux-bluetooth

Hi Jaganath,

On Fri, Jan 04, 2013, Jaganath Kanakkassery wrote:
> If bt_uuid2string() returns NULL then svcclass has to be freed
> ---
>  src/storage.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-04 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04  5:42 [PATCH 1/2] storage: Fix memory leak Jaganath Kanakkassery
2013-01-04  5:42 ` [PATCH 2/2] rfkill: Fix count parameter in read Jaganath Kanakkassery
2013-01-04 14:17 ` [PATCH 1/2] storage: Fix memory leak Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).