diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 2b8922a093..d642b02b17 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1820,6 +1820,7 @@ int router_load_single_router(const char *s, const char **msg) { routerinfo_t *ri; + int r; smartlist_t *lst; tor_assert(msg); *msg = NULL; @@ -1840,10 +1841,11 @@ router_load_single_router(const char *s, const char **msg) smartlist_add(lst, ri); routers_update_status_from_networkstatus(lst, 0); - if (router_add_to_routerlist(ri, msg, 0, 0)<0) { - log_warn(LD_DIR, "Couldn't add router to list: %s Dropping.", - *msg?*msg:"(No message)."); + if ((r=router_add_to_routerlist(ri, msg, 0, 0))<0) { /* we've already assigned to *msg now, and ri is already freed */ + tor_assert(*msg); + if (r < -1) + log_warn(LD_DIR, "Couldn't add router to list: %s Dropping.", *msg); smartlist_free(lst); return 0; } else { |