adiv5_swdp: Fix more memory leak.
This commit is contained in:
parent
35bcb4f7c6
commit
80154c5c7a
|
@ -124,9 +124,6 @@ int jlink_swdp_scan(bmp_info_t *info)
|
||||||
{
|
{
|
||||||
swdptap_init(info);
|
swdptap_init(info);
|
||||||
target_list_free();
|
target_list_free();
|
||||||
ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp));
|
|
||||||
if (!dp) /* calloc failed: heap exhaustion */
|
|
||||||
return 0;
|
|
||||||
uint8_t cmd[44];
|
uint8_t cmd[44];
|
||||||
cmd[0] = CMD_HW_JTAG3;
|
cmd[0] = CMD_HW_JTAG3;
|
||||||
cmd[1] = 0;
|
cmd[1] = 0;
|
||||||
|
@ -178,6 +175,9 @@ int jlink_swdp_scan(bmp_info_t *info)
|
||||||
DEBUG_WARN( "Line reset failed\n");
|
DEBUG_WARN( "Line reset failed\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp));
|
||||||
|
if (!dp) /* calloc failed: heap exhaustion */
|
||||||
|
return 0;
|
||||||
dp->idcode = jlink_adiv5_swdp_low_access(dp, 1, ADIV5_DP_IDCODE, 0);
|
dp->idcode = jlink_adiv5_swdp_low_access(dp, 1, ADIV5_DP_IDCODE, 0);
|
||||||
dp->dp_read = jlink_adiv5_swdp_read;
|
dp->dp_read = jlink_adiv5_swdp_read;
|
||||||
dp->error = jlink_adiv5_swdp_error;
|
dp->error = jlink_adiv5_swdp_error;
|
||||||
|
@ -186,6 +186,8 @@ int jlink_swdp_scan(bmp_info_t *info)
|
||||||
|
|
||||||
jlink_adiv5_swdp_error(dp);
|
jlink_adiv5_swdp_error(dp);
|
||||||
adiv5_dp_init(dp);
|
adiv5_dp_init(dp);
|
||||||
|
if (!target_list)
|
||||||
|
free(dp);
|
||||||
return target_list?1:0;
|
return target_list?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,6 +352,7 @@ int platform_adiv5_swdp_scan(void)
|
||||||
if (target_list)
|
if (target_list)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
free(dp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BMP_TYPE_CMSIS_DAP:
|
case BMP_TYPE_CMSIS_DAP:
|
||||||
|
@ -363,6 +364,7 @@ int platform_adiv5_swdp_scan(void)
|
||||||
if (target_list)
|
if (target_list)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
free(dp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BMP_TYPE_JLINK:
|
case BMP_TYPE_JLINK:
|
||||||
|
|
|
@ -82,6 +82,8 @@ int adiv5_swdp_scan(void)
|
||||||
|
|
||||||
firmware_swdp_error(dp);
|
firmware_swdp_error(dp);
|
||||||
adiv5_dp_init(dp);
|
adiv5_dp_init(dp);
|
||||||
|
if (!target_list)
|
||||||
|
free(dp);
|
||||||
return target_list?1:0;
|
return target_list?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue