projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use calloc instead of malloc+memset
[project/firewall3.git]
/
zones.c
diff --git
a/zones.c
b/zones.c
index fe507b0d82b7fc784aeb27ab057a93739e3e0e86..53c62461b927b2ae61dca04fe47335ba32870b33 100644
(file)
--- a/
zones.c
+++ b/
zones.c
@@
-128,13
+128,10
@@
fw3_alloc_zone(void)
{
struct fw3_zone *zone;
{
struct fw3_zone *zone;
- zone = malloc(sizeof(*zone));
-
+ zone = calloc(1, sizeof(*zone));
if (!zone)
return NULL;
if (!zone)
return NULL;
- memset(zone, 0, sizeof(*zone));
-
INIT_LIST_HEAD(&zone->networks);
INIT_LIST_HEAD(&zone->devices);
INIT_LIST_HEAD(&zone->subnets);
INIT_LIST_HEAD(&zone->networks);
INIT_LIST_HEAD(&zone->devices);
INIT_LIST_HEAD(&zone->subnets);
@@
-683,12
+680,10
@@
fw3_resolve_zone_addresses(struct fw3_zone *zone)
struct fw3_address *addr, *tmp;
struct list_head *addrs, *all;
struct fw3_address *addr, *tmp;
struct list_head *addrs, *all;
- all = malloc(sizeof(*all));
-
+ all = calloc(1, sizeof(*all));
if (!all)
return NULL;
if (!all)
return NULL;
- memset(all, 0, sizeof(*all));
INIT_LIST_HEAD(all);
list_for_each_entry(net, &zone->networks, list)
INIT_LIST_HEAD(all);
list_for_each_entry(net, &zone->networks, list)