]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid segfault when freeing options_t without firewall_ports
authorNick Mathewson <nickm@torproject.org>
Wed, 18 Aug 2004 07:06:53 +0000 (07:06 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 18 Aug 2004 07:06:53 +0000 (07:06 +0000)
svn:r2279

src/or/config.c

index 6d09b77644e3f95775d4329a63843ab83c1b5a27..e68d7ba5f9a6d0440d4065d6e2eef5cebabcc9f5 100644 (file)
@@ -545,8 +545,10 @@ static void free_options(or_options_t *options) {
   config_free_lines(options->DirBindAddress);
   config_free_lines(options->ExitPolicy);
   config_free_lines(options->SocksPolicy);
-  SMARTLIST_FOREACH(options->FirewallPorts, char *, cp, tor_free(cp));
-  smartlist_free(options->FirewallPorts);
+  if (options->FirewallPorts) {
+    SMARTLIST_FOREACH(options->FirewallPorts, char *, cp, tor_free(cp));
+    smartlist_free(options->FirewallPorts);
+  }
 }
 
 /** Set <b>options</b> to hold reasonable defaults for most options. */