attrib-server: Fix memory leak attaching attribute channels
PATCH 1/2 attrib-server: Fix memory leak attaching attribute channels
Channel is not being released when the channel is attached over an uninitialized GATT server.
--- src/attrib-server.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
src/attrib-server.c +7 -1
@@ -1020,8 +1020,14 @@ guint attrib_channel_attach(GAttrib *attrib, gboolean out) } server =find_gatt_server (&channel->src); -if (server ==NULL ) +if (server ==NULL ) { +char src[18 ]; + +ba2str (&channel->src, src); +error ("Not GATT server found in %s" , src); +g_free (channel);return 0 ; + } channel->server = server;
Signature · 1 line
1.7.9
PATCH 2/2 attrib-server: Fix bad error message
--- src/attrib-server.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
src/attrib-server.c +1 -1
@@ -171,7 +171,7 @@ static struct gatt_server *find_gatt_server(const bdaddr_t *bdaddr)char addr[18 ];ba2str (bdaddr, addr); -error ("Not GATT adapter found for address %s" , addr); +error ("Not GATT server found in %s" , addr);return NULL ; }
Signature · 1 line
1.7.9
Re: [PATCH 2/2] attrib-server: Fix bad error message
Hi Santiago,
Quoted 9 lines · Santiago Carot-Nemesio
---
src/attrib-server.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/attrib-server.c +0
-0
src/attrib-server.c static struct gatt_server *find_gatt_server(const bdaddr_t *bdaddr) · line 174
Quoted 5 lines
src/attrib-server.c +1
-1@@ -171,7 +171,7 @@ static struct gatt_server *find_gatt_server(const bdaddr_t *bdaddr) char addr[18]; ba2str(bdaddr, addr); - error("Not GATT adapter found for address %s", addr); + error("Not GATT server found in %s", addr);
You can also fix: Not -> No
Quoted 5 lines
src/attrib-server.c +0
-1return NULL; } --1.7.9
Best Regards,
Signature · 3 lines
Anderson Lizardo Instituto Nokia de Tecnologia - INdT Manaus - Brazil
Re: [PATCH 2/2] attrib-server: Fix bad error message
Hi,
2012/2/7 Anderson Lizardo <[email protected]>:
Quoted 15 lines
Hi Santiago,
Quoted 11 lines · Santiago Carot-Nemesio
---
src/attrib-server.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)src/attrib-server.c +0
-0@@ -171,7 +171,7 @@ static struct gatt_server *find_gatt_server(const bdaddr_t *bdaddr) char addr[18];
Quoted 12 lines
src/attrib-server.c static struct gatt_server *find_gatt_server(const bdaddr_t *bdaddr) · line 174
Quoted 3 lines
src/attrib-server.c +1
-1ba2str(bdaddr, addr); - error("Not GATT adapter found for address %s", addr); + error("Not GATT server found in %s", addr);You can also fix: Not -> No
Quoted 5 lines
src/attrib-server.c +0
-1return NULL; } --1.7.9
Ok, ignore these two patches, I'll send another ones ASAP
Hi Santiago,
Quoted 11 lines · Santiago Carot-Nemesio
Channel is not being released when the channel is attached over an uninitialized GATT server.
---
src/attrib-server.c | 8 +++++++-1 files changed, 7 insertions(+), 1 deletions(-)src/attrib-server.c +0
-0
src/attrib-server.c guint attrib_channel_attach(GAttrib *attrib, gboolean out) · line 1027
Quoted 9 lines
src/attrib-server.c +5
-1@@ -1020,8 +1020,14 @@ guint attrib_channel_attach(GAttrib *attrib, gboolean out) } server = find_gatt_server(&channel->src); - if (server == NULL) + if (server == NULL) { + char src[18]; + + ba2str(&channel->src, src); + error("Not GATT server found in %s", src);
Looks ok, except for the typo: Not -> No
Quoted 8 lines
src/attrib-server.c +2
-1+ g_free(channel); return 0; + } channel->server = server; --1.7.9
Best Regards,
Signature · 3 lines
Anderson Lizardo Instituto Nokia de Tecnologia - INdT Manaus - Brazil