Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible nullptr dereference in esp_event_handler_register_with() (IDFGH-2224) #4373

Closed
AxelLin opened this issue Nov 20, 2019 · 0 comments
Closed
Assignees

Comments

@AxelLin
Copy link
Contributor

AxelLin commented Nov 20, 2019

esp-idf 4.0 beta2:
In esp_event/esp_event.c, esp_event_handler_register_with function:

The if (!loop_node) test needs to be done before SLIST_INIT.

` if (!last_loop_node ||
(last_loop_node && !SLIST_EMPTY(&(last_loop_node->base_nodes)) && is_loop_level_handler)) {
loop_node = (esp_event_loop_node_t*) calloc(1, sizeof(*loop_node));

    SLIST_INIT(&(loop_node->handlers));
    SLIST_INIT(&(loop_node->base_nodes));

    if (!loop_node) {
        ESP_LOGE(TAG, "alloc for new loop node failed");
        err = ESP_ERR_NO_MEM;
        goto on_err;
    }

`

@renzbagaporo renzbagaporo self-assigned this Nov 20, 2019
@github-actions github-actions bot changed the title Possible nullptr dereference in esp_event_handler_register_with() Possible nullptr dereference in esp_event_handler_register_with() (IDFGH-2224) Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants