esp_event: fix issue with post data preparation
Fixes an issue with post instance data preparation. Currently, there is no way to check if event data has really been set during handler execution preparation. When data is not allocated from the heap, user could have passed 0x0 which can lead to failed checks. This also implements using the already allocated data memory for posting events from non-ISR functions when data size is less than the capacity.
This commit is contained in:
@@ -97,7 +97,8 @@ typedef void* esp_event_post_data_t;
|
||||
/// Event posted to the event queue
|
||||
typedef struct esp_event_post_instance {
|
||||
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||
bool data_allocd; /**< indicates whether data is alloc'd */
|
||||
bool data_allocated; /**< indicates whether data is allocated from heap */
|
||||
bool data_set; /**< indicates if data is null */
|
||||
#endif
|
||||
esp_event_base_t base; /**< the event base */
|
||||
int32_t id; /**< the event id */
|
||||
|
||||
Reference in New Issue
Block a user