File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
connectivity/FEATURE_BLE/source/cordio/source Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 23
23
#include " wsf_types.h"
24
24
#include " att_api.h"
25
25
26
+ #include < new>
27
+
26
28
namespace ble {
27
29
namespace impl {
28
30
@@ -593,13 +595,18 @@ ble_error_t GattServer::insert_cccd(
593
595
*
594
596
* Ownership is passed to the GattCharacteristic
595
597
*/
596
- GattAttribute* implicit_cccd = new GattAttribute (
598
+ GattAttribute* implicit_cccd = new (std::nothrow) GattAttribute (
597
599
CCCD_UUID,
598
600
attribute_it->pValue ,
599
601
*attribute_it->pLen ,
600
602
attribute_it->maxLen ,
601
603
false );
602
604
605
+ if (implicit_cccd == nullptr ) {
606
+ currentHandle--;
607
+ return BLE_ERROR_NO_MEM;
608
+ }
609
+
603
610
implicit_cccd->setHandle (cccds[cccd_cnt].handle );
604
611
implicit_cccd->allowRead (true );
605
612
implicit_cccd->allowWrite (true );
You can’t perform that action at this time.
0 commit comments