fix(usb): fix warnings found by GNU static analyzer

This commit is contained in:
Alexey Lapshin
2024-06-18 00:17:15 +07:00
committed by BOT
parent a4e827bedd
commit 47aaedeb94

View File

@@ -395,8 +395,10 @@ esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_r
return ESP_OK;
cleanup:
free(phy_context->iopins);
free(phy_context);
if (phy_context) {
free(phy_context->iopins);
free(phy_context);
}
if (p_phy_ctrl_obj->ref_count == 0) {
free(p_phy_ctrl_obj);
p_phy_ctrl_obj = NULL;