[PATCH BlueZ 1/3] attrib: Fix memory leak on low memory condition

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

 



If g_try_new0() fails due to low memory condition, "list" should be
freed before returning from primary_all_cb().
---
 attrib/gatt.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 44d3eb6..e4c5385 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -226,6 +226,7 @@ static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
 
 		primary = g_try_new0(struct gatt_primary, 1);
 		if (!primary) {
+			att_data_list_free(list);
 			err = ATT_ECODE_INSUFF_RESOURCES;
 			goto done;
 		}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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