diff options
author | Sergey Borshch <sb-sf@users.sourceforge.net> | 2012-09-19 10:07:36 +0300 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2012-10-31 10:24:08 +0000 |
commit | fc302a025270ee6e1099aa58c1c833b0d080e4ce (patch) | |
tree | efd18295520b1f8ce7f4b4e0c4716a2cce304bf3 /src/server | |
parent | 6663a788a53ee38f2d6950fe7802eae7855e01f3 (diff) |
fix memory leaks
if add_connection() fails, memory allocated in copy_command_context() is lost.
Signed-off-by: Sergey Borshch <sb-sf@users.sourceforge.net>
Change-Id: I91a2757f29612038031eb8953100faa3b850d3a6
Reviewed-on: http://openocd.zylin.com/836
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/server.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server/server.c b/src/server/server.c index 96f06b3f..1499e738 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -85,6 +85,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c if (retval != ERROR_OK) { close_socket(c->fd); LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } @@ -104,6 +105,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } @@ -124,6 +126,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } |