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

This commit is contained in:
Alexey Lapshin
2024-08-21 14:05:31 +07:00
parent 9760884e60
commit 3759f41b94
2 changed files with 8 additions and 3 deletions
+4 -2
View File
@@ -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;
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;