[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Fix memory leak when options_init_from_string returns error #22605
commit ade9baaf9b40c419f3ddefe6c8ee8f2c5ec8edce
Author: Daniel Pinto <danielpinto52@xxxxxxxxx>
Date: Tue Sep 12 23:07:06 2017 +0100
Fix memory leak when options_init_from_string returns error #22605
---
src/or/config.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/or/config.c b/src/or/config.c
index 56d2e0621..753547767 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -5210,6 +5210,12 @@ options_init_from_string(const char *cf_defaults, const char *cf,
return SETOPT_OK;
err:
+ if (opened_files) {
+ SMARTLIST_FOREACH(opened_files, char *, f, tor_free(f));
+ smartlist_free(opened_files);
+ }
+ // may have been set to opened_files, avoid double free
+ newoptions->FilesOpenedByIncludes = NULL;
or_options_free(newoptions);
or_options_free(newdefaultoptions);
if (*msg) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits