From 7ba1f3911691d211a0297a4ec486d40c3d70bd8c Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Tue, 13 Nov 2018 10:09:29 +0100 Subject: [PATCH 1/3] libtorrunner: fix memory leak in child() error path This avoids leaking memory in case libtorrunner's child() function fails. --- src/tools/tor_runner.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/tor_runner.c b/src/tools/tor_runner.c index 9ed2ee5775..7c43b0d244 100644 --- a/src/tools/tor_runner.c +++ b/src/tools/tor_runner.c @@ -93,6 +93,7 @@ child(const tor_main_configuration_t *cfg) int rv = execv(BINDIR "/tor", args); if (rv < 0) { + free(args); exit(254); } else { abort(); /* Unreachable */ From 26fd7c1d9cdb7a3a4c379be7d309bd1b4c6bbaa4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 14 Nov 2018 07:51:36 -0500 Subject: [PATCH 2/3] Changes file for bug 28419 --- changes/bug28419 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changes/bug28419 diff --git a/changes/bug28419 b/changes/bug28419 new file mode 100644 index 0000000000..52ceb0a2a7 --- /dev/null +++ b/changes/bug28419 @@ -0,0 +1,3 @@ + o Minor bugfixes (memory leaks): + - Fix a harmless memory leak in libtorrunner.a. Fixes bug 28419; + bugfix on 0.3.3.1-alpha. Patch from Martin Kepplinger. \ No newline at end of file From db3acb3aa398bda46435d94427967410da173222 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 14 Nov 2018 07:54:57 -0500 Subject: [PATCH 3/3] Work around check-spaces. --- src/tools/tor_runner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tor_runner.c b/src/tools/tor_runner.c index 7c43b0d244..cad57a7665 100644 --- a/src/tools/tor_runner.c +++ b/src/tools/tor_runner.c @@ -80,6 +80,7 @@ tor_run_main(const tor_main_configuration_t *cfg) /* circumlocution to avoid getting warned about calling calloc instead of * tor_calloc. */ #define real_calloc calloc +#define real_free free static void child(const tor_main_configuration_t *cfg) @@ -93,10 +94,9 @@ child(const tor_main_configuration_t *cfg) int rv = execv(BINDIR "/tor", args); if (rv < 0) { - free(args); + real_free(args); exit(254); } else { abort(); /* Unreachable */ } } -