forked from espressif/esp-idf
fix(esp_http_server): fix GCC 14 analyzer warnings
This commit is contained in:
@@ -146,11 +146,13 @@ esp_err_t httpd_register_uri_handler(httpd_handle_t handle,
|
||||
|
||||
for (int i = 0; i < hd->config.max_uri_handlers; i++) {
|
||||
if (hd->hd_calls[i] == NULL) {
|
||||
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") // False-positive detection. TODO GCC-366
|
||||
hd->hd_calls[i] = malloc(sizeof(httpd_uri_t));
|
||||
if (hd->hd_calls[i] == NULL) {
|
||||
/* Failed to allocate memory */
|
||||
return ESP_ERR_HTTPD_ALLOC_MEM;
|
||||
}
|
||||
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak")
|
||||
|
||||
/* Copy URI string */
|
||||
hd->hd_calls[i]->uri = strdup(uri_handler->uri);
|
||||
|
Reference in New Issue
Block a user