forked from espressif/esp-idf
fix(usb): fix warnings found by GNU static analyzer
This commit is contained in:
@@ -1593,9 +1593,12 @@ static dma_buffer_block_t *buffer_block_alloc(usb_transfer_type_t type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dma_buffer_block_t *buffer = calloc(1, sizeof(dma_buffer_block_t));
|
dma_buffer_block_t *buffer = calloc(1, sizeof(dma_buffer_block_t));
|
||||||
|
if (buffer == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
size_t real_len = 0;
|
size_t real_len = 0;
|
||||||
void *xfer_desc_list = transfer_descriptor_list_alloc(desc_list_len, &real_len);
|
void *xfer_desc_list = transfer_descriptor_list_alloc(desc_list_len, &real_len);
|
||||||
if (buffer == NULL || xfer_desc_list == NULL) {
|
if (xfer_desc_list == NULL) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
heap_caps_free(xfer_desc_list);
|
heap_caps_free(xfer_desc_list);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -340,8 +340,10 @@ esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_r
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
if (phy_context) {
|
||||||
free(phy_context->iopins);
|
free(phy_context->iopins);
|
||||||
free(phy_context);
|
free(phy_context);
|
||||||
|
}
|
||||||
if (p_phy_ctrl_obj->ref_count == 0) {
|
if (p_phy_ctrl_obj->ref_count == 0) {
|
||||||
free(p_phy_ctrl_obj);
|
free(p_phy_ctrl_obj);
|
||||||
p_phy_ctrl_obj = NULL;
|
p_phy_ctrl_obj = NULL;
|
||||||
|
Reference in New Issue
Block a user