kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/static_analysis_mem_issues' into 'master'
fix minor static analysis memory issues See merge request espressif/esp-idf!8697pull/5452/head
commit
a9c61dca4e
|
@ -621,14 +621,22 @@ esp_err_t esp_http_client_cleanup(esp_http_client_handle_t client)
|
|||
}
|
||||
esp_http_client_close(client);
|
||||
esp_transport_list_destroy(client->transport_list);
|
||||
http_header_destroy(client->request->headers);
|
||||
free(client->request->buffer->data);
|
||||
free(client->request->buffer);
|
||||
free(client->request);
|
||||
http_header_destroy(client->response->headers);
|
||||
free(client->response->buffer->data);
|
||||
free(client->response->buffer);
|
||||
free(client->response);
|
||||
if (client->request) {
|
||||
http_header_destroy(client->request->headers);
|
||||
if (client->request->buffer) {
|
||||
free(client->request->buffer->data);
|
||||
}
|
||||
free(client->request->buffer);
|
||||
free(client->request);
|
||||
}
|
||||
if (client->response) {
|
||||
http_header_destroy(client->response->headers);
|
||||
if (client->response->buffer) {
|
||||
free(client->response->buffer->data);
|
||||
}
|
||||
free(client->response->buffer);
|
||||
free(client->response);
|
||||
}
|
||||
|
||||
free(client->parser);
|
||||
free(client->parser_settings);
|
||||
|
@ -700,7 +708,10 @@ esp_err_t esp_http_client_set_url(esp_http_client_handle_t client, const char *u
|
|||
|
||||
if (purl.field_data[UF_HOST].len) {
|
||||
http_utils_assign_string(&client->connection_info.host, url + purl.field_data[UF_HOST].off, purl.field_data[UF_HOST].len);
|
||||
HTTP_MEM_CHECK(TAG, client->connection_info.host, return ESP_ERR_NO_MEM);
|
||||
HTTP_MEM_CHECK(TAG, client->connection_info.host, {
|
||||
free(old_host);
|
||||
return ESP_ERR_NO_MEM;
|
||||
});
|
||||
}
|
||||
// Close the connection if host was changed
|
||||
if (old_host && client->connection_info.host
|
||||
|
|
|
@ -214,7 +214,7 @@ static void esp_local_ctrl_command_cleanup(LocalCtrlMessage *resp, void **ctx)
|
|||
if (resp->resp_get_prop_vals) {
|
||||
prop_val_free_fn_t *free_fns = (prop_val_free_fn_t *)(*ctx);
|
||||
for (size_t i = 0; i < resp->resp_get_prop_vals->n_props; i++) {
|
||||
if (free_fns[i]) {
|
||||
if (free_fns && free_fns[i]) {
|
||||
free_fns[i](resp->resp_get_prop_vals->props[i]->value.data);
|
||||
}
|
||||
free(resp->resp_get_prop_vals->props[i]);
|
||||
|
|
|
@ -76,6 +76,7 @@ esp_err_t esp_netif_add_to_list(esp_netif_t *netif)
|
|||
item->netif = netif;
|
||||
|
||||
if ((ret = esp_netif_list_lock()) != ESP_OK) {
|
||||
free(item);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -281,7 +281,11 @@ static void timer_process_alarm(esp_timer_dispatch_t dispatch_method)
|
|||
int64_t now = esp_timer_impl_get_time();
|
||||
esp_timer_handle_t it = LIST_FIRST(&s_timers);
|
||||
while (it != NULL &&
|
||||
it->alarm < now) {
|
||||
it->alarm < now) { // NOLINT(clang-analyzer-unix.Malloc)
|
||||
// Static analyser reports "Use of memory after it is freed" since the "it" variable
|
||||
// is freed below (if EVENT_ID_DELETE_TIMER) and assigned to the (new) LIST_FIRST()
|
||||
// so possibly (if the "it" hasn't been removed from the list) it might keep the same ptr.
|
||||
// Ignoring this warning, as this couldn't happen if queue.h used to populate the list
|
||||
LIST_REMOVE(it, list_entry);
|
||||
if (it->event_id == EVENT_ID_DELETE_TIMER) {
|
||||
free(it);
|
||||
|
|
Ładowanie…
Reference in New Issue