From accbeaed99bc6014d060259d6b0b0e080c0f44b4 Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Fri, 21 Feb 2025 12:33:45 -0500 Subject: [PATCH] gdb_server: fix invalid free `gdb_service_free` calls `free(gdb_port_next)`, so this needs to be an allocated string. Otherwise we trip up detectors like Android's tagged pointers. Change-Id: Ib08ea55a38af4e15c4fbae95f10db0e3684ae1af Signed-off-by: Jim Paris Reviewed-on: https://review.openocd.org/c/openocd/+/8768 Reviewed-by: Tomas Vanek Reviewed-by: Antonio Borneo Tested-by: jenkins --- src/server/gdb_server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 1866de0b5..71b7c7764 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -3898,7 +3898,8 @@ static int gdb_target_add_one(struct target *target) } } } else if (strcmp(gdb_port_next, "pipe") == 0) { - gdb_port_next = "disabled"; + free(gdb_port_next); + gdb_port_next = strdup("disabled"); } } return retval;