This is an automated email from Gerrit. "zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8637
-- gerrit commit 07a05b249bbd5064639fca49e4c43ff6f0b1dfc8 Author: Marc Schink <d...@zapb.de> Date: Wed Dec 4 14:42:00 2024 +0100 target: Fix memory leak of 'private_config' The 'private_config' member is not free'd in case of an error. Fix this memory leak. While at it, fix a coding style issue. Change-Id: I72381d9d88c0624d53df5b48adc21b9d4cf4e349 Signed-off-by: Marc Schink <d...@zapb.de> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 7a8866314b..64c3816f06 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -2441,8 +2441,6 @@ err_no_param: int adiv5_jim_configure_ext(struct target *target, struct jim_getopt_info *goi, struct adiv5_private_config *pc, enum adiv5_configure_dap_optional optional) { - int e; - if (!pc) { pc = (struct adiv5_private_config *)target->private_config; if (!pc) { @@ -2459,13 +2457,16 @@ int adiv5_jim_configure_ext(struct target *target, struct jim_getopt_info *goi, if (optional == ADI_CONFIGURE_DAP_COMPULSORY) target->has_dap = true; - e = adiv5_jim_spot_configure(goi, &pc->dap, &pc->ap_num, NULL); - if (e != JIM_OK) + int e = adiv5_jim_spot_configure(goi, &pc->dap, &pc->ap_num, NULL); + if (e != JIM_OK) { + free(pc); return e; + } if (pc->dap && !target->dap_configured) { if (target->tap_configured) { pc->dap = NULL; + free(pc); Jim_SetResultString(goi->interp, "-chain-position and -dap configparams are mutually exclusive!", -1); return JIM_ERR; --