Re: [PATCH 1/1] adapter: Fix memory leak

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

 



Hi,
------- Original Message -------
Sender : SYAM SIDHARDHAN<s.syam@xxxxxxxxxxx> ./Senior Chief Engineer/SRI-Bangalore-System & Connectivity/Samsung Electronics
Date : Feb 03, 2016 20:28 (GMT+05:30)
Title : [PATCH 1/1] adapter: Fix memory leak

if strlen(str) < 32 then there is a memory leak.
---
src/adapter.c |    5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index b184eed..f4fbf82 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3091,12 +3091,12 @@ static GSList *get_ltk_info(GKeyFile *key_file, const char *peer,
static struct irk_info *get_irk_info(GKeyFile *key_file, const char *peer,
uint8_t bdaddr_type)
{
- struct irk_info *irk;
+ struct irk_info *irk = NULL;
char *str;

str = g_key_file_get_string(key_file, "IdentityResolvingKey", "Key", NULL);
if (!str || strlen(str) < 32)
- return NULL;
+ goto failed;

irk = g_new0(struct irk_info, 1);

@@ -3108,6 +3108,7 @@ static struct irk_info *get_irk_info(GKeyFile *key_file, const char *peer,
else
str2buf(&str[0], irk->val, sizeof(irk->val));

+failed:
g_free(str);

return irk;
-- 
1.7.9.5

Pingÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±ý¹nzÚ(¶âžØ^n‡r¡ö¦zË?ëh™¨è­Ú&£ûàz¿äz¹Þ—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿï?êÿ‘êçz_è®æj:+v‰¨þ)ߣøm




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux