Skip to content

Commit 49d983a

Browse files
authored
feat(zigbee_ep): use static heap memory for manufacturer and model names
1 parent 83d0f42 commit 49d983a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libraries/Zigbee/src/ZigbeeEP.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ typedef enum {
4141
/* Zigbee End Device Class */
4242
class ZigbeeEP {
4343
public:
44+
// constants and limits
45+
static constexpr size_t ZB_MAX_NAME_LENGTH = 32;
46+
47+
// constructors and destructor
4448
ZigbeeEP(uint8_t endpoint = 10);
45-
~ZigbeeEP() {
46-
free(_read_manufacturer);
47-
free(_read_model);
48-
}
49+
~ZigbeeEP() {}
4950

5051
// Set ep config and cluster list
5152
void setEpConfig(esp_zb_endpoint_config_t ep_config, esp_zb_cluster_list_t *cluster_list) {
@@ -141,8 +142,8 @@ class ZigbeeEP {
141142
}
142143

143144
private:
144-
char *_read_manufacturer;
145-
char *_read_model;
145+
char _read_manufacturer[ZB_MAX_NAME_LENGTH + 1]; // + 1 for the extra '\0'
146+
char _read_model[ZB_MAX_NAME_LENGTH + 1]; // + 1 for the extra '\0'
146147
void (*_on_identify)(uint16_t time);
147148
time_t _read_time;
148149
int32_t _read_timezone;

0 commit comments

Comments
 (0)