diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-07-24 12:32:06 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-07-24 12:32:06 +0300 |
commit | b0a06e7b186f728a25c75743f30965b2ee46dc26 (patch) | |
tree | d0454c92c5e4d6b673d931b6ca40c5d79b112428 | |
parent | 63408730473df401c6610cad1e7aec63fd76ef76 (diff) | |
parent | bb33a2f290561f96a2ab980f295e9bafcde39707 (diff) | |
download | tor-b0a06e7b186f728a25c75743f30965b2ee46dc26.tar.gz tor-b0a06e7b186f728a25c75743f30965b2ee46dc26.zip |
Merge branch 'maint-0.4.1' into release-0.4.1
-rw-r--r-- | changes/bug31003 | 4 | ||||
-rw-r--r-- | src/feature/nodelist/routerlist.c | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/changes/bug31003 b/changes/bug31003 new file mode 100644 index 0000000000..6c75163380 --- /dev/null +++ b/changes/bug31003 @@ -0,0 +1,4 @@ + o Minor bugfixes (crash on exit): + - Avoid a set of possible code paths that could use try to use freed memory + in routerlist_free() while Tor was exiting. Fixes bug 31003; bugfix on + 0.1.2.2-alpha. diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c index 5788347a0e..9c2debea2f 100644 --- a/src/feature/nodelist/routerlist.c +++ b/src/feature/nodelist/routerlist.c @@ -954,20 +954,18 @@ routerlist_free_(routerlist_t *rl) smartlist_free(rl->routers); smartlist_free(rl->old_routers); if (rl->desc_store.mmap) { - int res = tor_munmap_file(routerlist->desc_store.mmap); + int res = tor_munmap_file(rl->desc_store.mmap); if (res != 0) { log_warn(LD_FS, "Failed to munmap routerlist->desc_store.mmap"); } } if (rl->extrainfo_store.mmap) { - int res = tor_munmap_file(routerlist->extrainfo_store.mmap); + int res = tor_munmap_file(rl->extrainfo_store.mmap); if (res != 0) { log_warn(LD_FS, "Failed to munmap routerlist->extrainfo_store.mmap"); } } tor_free(rl); - - router_dir_info_changed(); } /** Log information about how much memory is being used for routerlist, @@ -1426,8 +1424,10 @@ routerlist_reparse_old(routerlist_t *rl, signed_descriptor_t *sd) void routerlist_free_all(void) { - routerlist_free(routerlist); - routerlist = NULL; + routerlist_t *rl = routerlist; + routerlist = NULL; // Prevent internals of routerlist_free() from using + // routerlist. + routerlist_free(rl); dirlist_free_all(); if (warned_nicknames) { SMARTLIST_FOREACH(warned_nicknames, char *, cp, tor_free(cp)); |