[PATCH BlueZ 3/3] attrib: Fix status on memory allocation failure

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

 



If memory allocation fails, ATT_ECODE_INSUFF_RESOURCES should be
reported to the callback.
---
 attrib/gatt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index c1aa070..38d455a 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -651,8 +651,10 @@ static void read_char_helper(guint8 status, const guint8 *rpdu,
 		goto done;
 
 	long_read->buffer = g_malloc(rlen);
-	if (long_read->buffer == NULL)
+	if (long_read->buffer == NULL) {
+		status = ATT_ECODE_INSUFF_RESOURCES;
 		goto done;
+	}
 
 	memcpy(long_read->buffer, rpdu, rlen);
 	long_read->size = rlen;
-- 
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