From 097ed9998bc93b2dff1c6dcbff974ab4d8d17731 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 6 Oct 2011 12:54:34 -0400 Subject: [PATCH 1/3] Fix memory leak in options_act_reversible: fix Coverity CID 486,487 --- src/or/config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/or/config.c b/src/or/config.c index 3080da0485..c5322f5120 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1077,8 +1077,11 @@ options_act_reversible(const or_options_t *old_options, char **msg) } /* Adjust the client port configuration so we can launch listeners. */ - if (parse_client_ports(options, 0, msg, &n_client_ports)) - return -1; + if (parse_client_ports(options, 0, msg, &n_client_ports)) { + if (!*msg) + *msg = tor_strdup("Unexpected problem parsing client port config"); + goto rollback; + } /* Set the hibernation state appropriately.*/ consider_hibernation(time(NULL)); From b1632c3fb742f94a6ce0de201653a8c4a9d2887f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 6 Oct 2011 12:57:07 -0400 Subject: [PATCH 2/3] Fix memory leak in retry_all_listeners: Coverity CID 485 --- src/or/connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index af0572905d..bf39a5cb9c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1988,13 +1988,13 @@ retry_all_listeners(smartlist_t *replaced_conns, options->ControlListenAddress, options->ControlPort, "127.0.0.1", new_conns, 0) < 0) - return -1; + retval = -1; if (retry_listeners(listeners, CONN_TYPE_CONTROL_LISTENER, options->ControlSocket, options->ControlSocket ? 1 : 0, NULL, new_conns, 1) < 0) - return -1; + retval = -1; /* Any members that were still in 'listeners' don't correspond to * any configured port. Kill 'em. */ From ce6a2c2f140a3c1af9d6544f90d5fff1e06ffc42 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 6 Oct 2011 14:08:07 -0400 Subject: [PATCH 3/3] Changelog for recent coverity issues --- changes/cov_485,486,487 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/cov_485,486,487 diff --git a/changes/cov_485,486,487 b/changes/cov_485,486,487 new file mode 100644 index 0000000000..648b010f5d --- /dev/null +++ b/changes/cov_485,486,487 @@ -0,0 +1,5 @@ + o Minor bugfixes: + - Fix memory leaks in the failing cases of the new SocksPort and + ControlPort code. Found by Coverity Scan. Bugfix on + 0.2.3.3-alpha; fixes coverity CID 485, 486, and 487. +