Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] shared/gatt: Fix freeing uninitialized attributes
@ 2014-05-16 10:07 Marcin Kraglak
  2014-05-16 12:36 ` Szymon Janc
  2014-05-16 15:17 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Marcin Kraglak @ 2014-05-16 10:07 UTC (permalink / raw)
  To: linux-bluetooth

Don't free uninitialized attributes. It could cause NULL pointer
dereference.
---
 src/shared/gatt-db.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index d9f63be..36316af 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -99,6 +99,10 @@ static void attribute_destroy(void *data)
 {
 	struct gatt_db_attribute *attribute = data;
 
+	/* Attribute was not initialized by user */
+	if (!attribute)
+		return;
+
 	free(attribute->value);
 	free(attribute);
 }
-- 
1.9.0


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

end of thread, other threads:[~2014-05-16 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-16 10:07 [PATCH] shared/gatt: Fix freeing uninitialized attributes Marcin Kraglak
2014-05-16 12:36 ` Szymon Janc
2014-05-16 15:17 ` Marcel Holtmann
2014-05-16 16:24   ` Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox