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 2323#include " wsf_types.h"
2424#include " att_api.h"
2525
26+ #include < new>
27+
2628namespace ble {
2729namespace impl {
2830
@@ -593,13 +595,18 @@ ble_error_t GattServer::insert_cccd(
593595 *
594596 * Ownership is passed to the GattCharacteristic
595597 */
596- GattAttribute* implicit_cccd = new GattAttribute (
598+ GattAttribute* implicit_cccd = new (std::nothrow) GattAttribute (
597599 CCCD_UUID,
598600 attribute_it->pValue ,
599601 *attribute_it->pLen ,
600602 attribute_it->maxLen ,
601603 false );
602604
605+ if (implicit_cccd == nullptr ) {
606+ currentHandle--;
607+ return BLE_ERROR_NO_MEM;
608+ }
609+
603610 implicit_cccd->setHandle (cccds[cccd_cnt].handle );
604611 implicit_cccd->allowRead (true );
605612 implicit_cccd->allowWrite (true );
You can’t perform that action at this time.
0 commit comments