Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] android/hog: Fix double queue_destroy
@ 2015-03-12 13:37 Mariusz Skamra
  2015-03-12 13:37 ` [PATCH 2/2] unit/test-hog: Add TC/HGRF/RH/BV-01-I test Mariusz Skamra
  2015-03-12 14:19 ` [PATCH 1/2] android/hog: Fix double queue_destroy Szymon Janc
  0 siblings, 2 replies; 5+ messages in thread
From: Mariusz Skamra @ 2015-03-12 13:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mariusz Skamra

There is no need to destroy these queues here, there are destroyed in
hog_free. Prevents from memory violation.
---
 android/hog.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/android/hog.c b/android/hog.c
index 88a5460..9f1fbca 100644
--- a/android/hog.c
+++ b/android/hog.c
@@ -1180,23 +1180,11 @@ struct bt_hog *bt_hog_new(const char *name, uint16_t vendor, uint16_t product,
 		return NULL;
 
 	hog->gatt_op = queue_new();
-	if (!hog->gatt_op) {
-		hog_free(hog);
-		return NULL;
-	}
-
 	hog->bas = queue_new();
-	if (!hog->bas) {
-		queue_destroy(hog->gatt_op, NULL);
-		hog_free(hog);
-		return NULL;
-	}
-
 	hog->uhid = bt_uhid_new_default();
-	if (!hog->uhid) {
+
+	if (!(hog->gatt_op && hog->bas && hog->uhid)) {
 		hog_free(hog);
-		queue_destroy(hog->gatt_op, NULL);
-		queue_destroy(hog->bas, NULL);
 		return NULL;
 	}
 
-- 
1.9.1


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

end of thread, other threads:[~2015-03-13 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 13:37 [PATCH 1/2] android/hog: Fix double queue_destroy Mariusz Skamra
2015-03-12 13:37 ` [PATCH 2/2] unit/test-hog: Add TC/HGRF/RH/BV-01-I test Mariusz Skamra
2015-03-12 14:19 ` [PATCH 1/2] android/hog: Fix double queue_destroy Szymon Janc
2015-03-12 14:48   ` [PATCHv2 " Mariusz Skamra
2015-03-13 15:28     ` Szymon Janc

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