diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-21 18:28:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-21 18:28:53 -0400 |
commit | cb13930f2bc21c09bc0e5a4a01487a4a9f82707f (patch) | |
tree | 62e5d630eb0b96ac61e4cf27964ecc6d97bbdd8a /src/app/config/config.c | |
parent | bd518b9ab1815a28cbc43a03924182bbca2c4a12 (diff) | |
download | tor-cb13930f2bc21c09bc0e5a4a01487a4a9f82707f.tar.gz tor-cb13930f2bc21c09bc0e5a4a01487a4a9f82707f.zip |
Fix a memory leak introduced by the changes to test_options.c
Since this code passes the same options to options_validate() more
than once, options_validate() needs to be prepared for that. (This
previously worked by accident, since the smartlist of schedulers
wasn't initialized.)
Diffstat (limited to 'src/app/config/config.c')
-rw-r--r-- | src/app/config/config.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index c7ae453d5c..a202454e2c 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -3330,6 +3330,10 @@ options_validate_scheduler(or_options_t *options, char **msg) "can be used or set at least one value."); } /* Ok, we do have scheduler types, validate them. */ + if (options->SchedulerTypes_) { + SMARTLIST_FOREACH(options->SchedulerTypes_, int *, iptr, tor_free(iptr)); + smartlist_free(options->SchedulerTypes_); + } options->SchedulerTypes_ = smartlist_new(); SMARTLIST_FOREACH_BEGIN(options->Schedulers, const char *, type) { int *sched_type; |