mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 21:53:48 +01:00
Fix memory leak when options_init_from_string returns error #22605
This commit is contained in:
parent
23147dd168
commit
ade9baaf9b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user