Sfoglia il codice sorgente

* Ported [2784] to 1.2.10
* Fixed a segfault in cmd_rehash and revised help listing for it. (fixes #242)


svn: 2785

Bryan Drewery 20 anni fa
parent
commit
7d10c405ce
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 1 0
      doc/UPDATES
  2. 5 3
      src/binary.c

+ 1 - 0
doc/UPDATES

@@ -14,6 +14,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed cmd_trace to use 2 decimal places in display for seconds. (fixes #207)
 * Fixed cmd_trace not displaying hops correctly.
 * Expand symbolic links when searching for tempdirs. (fixes #210)
+* Fixed a segfault in cmd_rehash and revised help listing for it. (fixes #242)
 
 1.2.9 - http://tracker.shatow.net/milestone/1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 5 - 3
src/binary.c

@@ -553,7 +553,7 @@ void reload_bin_data() {
     fill_conf_bot();
 
     /* If we don't have conf.bot, then all bots were removed or just our own record */
-    if ((!conf.bot && oldbots->localhub) || (conf.bot && !conf.bot->localhub && oldbots->localhub)) {
+    if (oldbots && ((!conf.bot && oldbots->localhub) || (conf.bot && !conf.bot->localhub && oldbots->localhub))) {
       /* no longer the localhub (or removed), need to alert the new one to rehash */
       if (conf.bots->pid)
         conf_killbot(NULL, conf.bots, SIGHUP);		//restart the new localhub
@@ -562,7 +562,8 @@ void reload_bin_data() {
     }
     if (conf.bot && conf.bot->localhub) {
       /* kill and remove bots removed from conf */
-      kill_removed_bots(oldbots, conf.bots);
+      if (oldbots)
+        kill_removed_bots(oldbots, conf.bots);
       /* add any bots not in userfile */
       conf_add_userlist_bots();
       /* start/disable new bots as necesary */
@@ -571,7 +572,8 @@ void reload_bin_data() {
     } else
       free_conf_bots(conf.bots);
 
-    free_conf_bots(oldbots);
+    if (oldbots)
+      free_conf_bots(oldbots);
   }
 }