summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Oliver <ntfreak@users.sourceforge.net>2010-10-04 20:35:33 +0100
committerSpencer Oliver <ntfreak@users.sourceforge.net>2010-10-04 20:35:33 +0100
commit7e4cf8db585841985115a6835d403613487993a2 (patch)
tree4e5decf6c72745d8fcb48990852e13c0eb6ec9cd
parent45de3b1fbe875de7ed322d76bb517bdb48e20a5a (diff)
downloadopenocd_libswd-7e4cf8db585841985115a6835d403613487993a2.tar.gz
openocd_libswd-7e4cf8db585841985115a6835d403613487993a2.tar.bz2
openocd_libswd-7e4cf8db585841985115a6835d403613487993a2.tar.xz
openocd_libswd-7e4cf8db585841985115a6835d403613487993a2.zip
gdbserver: fix gdb_port memory leak
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
-rw-r--r--src/server/gdb_server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 51809026..74dec63c 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2466,8 +2466,10 @@ COMMAND_HANDLER(handle_gdb_sync_command)
COMMAND_HANDLER(handle_gdb_port_command)
{
int retval = CALL_COMMAND_HANDLER(server_pipe_command, &gdb_port);
- if (ERROR_OK == retval)
+ if (ERROR_OK == retval) {
+ free((void*)gdb_port_next);
gdb_port_next = strdup(gdb_port);
+ }
return retval;
}