diff options
author | Petr Štetiar <ynezz@true.cz> | 2020-12-08 18:54:57 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-12-11 11:17:22 +0100 |
commit | 086c292160ace27274b47a7c37e22fd173b2da9b (patch) | |
tree | 9522e0adf7001f3bdb878d98536b1f27e460d68c | |
parent | a3c1a88b031afa077965378e119947a276e78e23 (diff) | |
download | uclient-086c292160ace27274b47a7c37e22fd173b2da9b.tar.gz |
uclient-fetch: init_ca_cert: fix memory leak
Fixes following memory leak:
$ valgrind --quiet --leak-check=full uclient-fetch -q http://127.0.0.1:1922/does-not-exist
51 (16 direct, 35 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 9
at 0x4C31A3F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4C33D84: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x553C7DF: glob_in_dir (glob.c:1410)
by 0x553D5E8: glob@@GLIBC_2.27 (glob.c:1097)
by 0x401D62: init_ca_cert (uclient-fetch.c:503)
by 0x401D62: main (uclient-fetch.c:741)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r-- | uclient-fetch.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c index 1c66ac6..bbf5eec 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -503,6 +503,7 @@ static void init_ca_cert(void) glob("/etc/ssl/certs/*.crt", 0, NULL, &gl); for (i = 0; i < gl.gl_pathc; i++) ssl_ops->context_add_ca_crt_file(ssl_ctx, gl.gl_pathv[i]); + globfree(&gl); } static void init_ustream_ssl(void) |