]> git.sur5r.net Git - openocd/commitdiff
gdbserver: fix gdb_port memory leak
authorSpencer Oliver <ntfreak@users.sourceforge.net>
Mon, 4 Oct 2010 19:35:33 +0000 (20:35 +0100)
committerSpencer Oliver <ntfreak@users.sourceforge.net>
Mon, 4 Oct 2010 19:35:33 +0000 (20:35 +0100)
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
src/server/gdb_server.c

index 518090265ae9a2449f877835c4e9eff51b35c44c..74dec63c819f859309248675f1d57f2559df0a01 100644 (file)
@@ -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;
 }