File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,11 @@ void ZigbeeEP::zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute) {
251
251
if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID && attribute->data .type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data .value ) {
252
252
zbstring_t *zbstr = (zbstring_t *)attribute->data .value ;
253
253
char *_read_manufacturer = (char *) malloc (zbstr->len + 1 );
254
+ if (_read_manufacturer == nullptr ) {
255
+ log_e (" Failed to allocate memory for manufacturer data" );
256
+ xSemaphoreGive (lock);
257
+ return ;
258
+ }
254
259
memcpy (_read_manufacturer, zbstr->data , zbstr->len );
255
260
_read_manufacturer[zbstr->len ] = ' \0 ' ;
256
261
log_i (" Peer Manufacturer is \" %s\" " , _read_manufacturer);
@@ -259,6 +264,11 @@ void ZigbeeEP::zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute) {
259
264
if (attribute->id == ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID && attribute->data .type == ESP_ZB_ZCL_ATTR_TYPE_CHAR_STRING && attribute->data .value ) {
260
265
zbstring_t *zbstr = (zbstring_t *)attribute->data .value ;
261
266
char *_read_model = (char *) malloc (zbstr->len + 1 );
267
+ if (_read_model == nullptr ) {
268
+ log_e (" Failed to allocate memory for model data" );
269
+ xSemaphoreGive (lock);
270
+ return ;
271
+ }
262
272
memcpy (_read_model, zbstr->data , zbstr->len );
263
273
_read_model[zbstr->len ] = ' \0 ' ;
264
274
log_i (" Peer Model is \" %s\" " , _read_model);
You can’t perform that action at this time.
0 commit comments