This is an automated email from Gerrit. "Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7962
-- gerrit commit 168abeaad625fa75dbba294f83251237b8b82101 Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Sun Nov 5 17:02:26 2023 +0100 target: fix segmentation fault on target create In the unusual (and even incorrect) case of running the command target create ... before defining an adapter and the associated transport, the command causes a segmentation fault. E.g.: openocd -c 'target create cpu cortex-m -endian little' Check that get_current_transport() returns a valid pointer before referencing it. Change-Id: I9796a7e92196ef3df5c7152b27c34102045dc9e7 Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/target/target.c b/src/target/target.c index 10d0088d53..19fa33c9fb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -6124,7 +6124,7 @@ static int target_create(struct jim_getopt_info *goi) if (e != JIM_OK) return e; struct transport *tr = get_current_transport(); - if (tr->override_target) { + if (tr && tr->override_target) { e = tr->override_target(&cp); if (e != ERROR_OK) { LOG_ERROR("The selected transport doesn't support this target"); --