You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2019/09/13 13:32:48 UTC

[mynewt-nimble] 18/32: apps/bttester: Add missing return buf check

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 951abc9c3501d803e4266e6e7ce898e53e3bbfef
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Wed Jul 24 15:47:14 2019 +0200

    apps/bttester: Add missing return buf check
---
 apps/bttester/src/gatt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/bttester/src/gatt.c b/apps/bttester/src/gatt.c
index dba4442..a69fa57 100644
--- a/apps/bttester/src/gatt.c
+++ b/apps/bttester/src/gatt.c
@@ -1720,6 +1720,11 @@ static void write_long(u8_t *data, u16_t len)
 
 	om = ble_hs_mbuf_from_flat(cmd->data, sys_le16_to_cpu(cmd->data_length));
 
+	if (!om) {
+		SYS_LOG_ERR("Insufficient resources");
+		goto fail;
+	}
+
 	if (ble_gattc_write_long(conn.conn_handle, sys_le16_to_cpu(cmd->handle),
 				 sys_le16_to_cpu(cmd->offset), om, write_rsp,
 				 (void *) GATT_WRITE_LONG)) {