zones: drop outgoing invalid traffic in masqueraded zones
[project/firewall3.git] / includes.c
index 42d5b7a..a9a75cb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * firewall3 - 3rd OpenWrt UCI firewall implementation
  *
- *   Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ *   Copyright (C) 2013 Jo-Philipp Wich <jo@mein.io>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -47,13 +47,10 @@ fw3_load_includes(struct fw3_state *state, struct uci_package *p)
                if (strcmp(s->type, "include"))
                        continue;
 
-               include = malloc(sizeof(*include));
-
+               include = calloc(1, sizeof(*include));
                if (!include)
                        continue;
 
-               memset(include, 0, sizeof(*include));
-
                include->name = e->name;
                include->enabled = true;
 
@@ -135,7 +132,8 @@ fw3_print_includes(struct fw3_state *state, enum fw3_family family, bool reload)
                print_include(include);
        }
 
-       fw3_command_close();
+       if (exec)
+               fw3_command_close();
 }