The array 'wps_to_enable' is never freed. Scan build reports: src/target/riscv/riscv.c:4271:6: warning: Potential leak of memory pointed to by 'wps_to_enable' [unix.Malloc] Add the needed free(). While there, check if the allocation is successful. Change-Id: I00e7ade37a43a97dcc245113ad93c48784fce609 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9163 Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins