From 0fc3c465cde62aa72c92da1add5b7c38281764db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20LU=C3=87I?= Date: Mon, 12 Jan 2015 12:20:57 +0100 Subject: Actually improve the previous resource leak commit since the function is there but it was not being used during init_rules process. --- etc/inc/captiveportal.inc | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'etc') diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index c42eb35..e24982e 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -484,7 +484,7 @@ function captiveportal_init_rules($reinit = false) { captiveportal_load_modules(); mwexec("/sbin/ipfw zone {$cpzoneid} create", true); - captiveportal_flush_dn_ruleno($cpzone); + captiveportal_free_dnrules(); $cpips = array(); $ifaces = get_configured_interface_list(); @@ -1491,26 +1491,6 @@ function captiveportal_free_dn_ruleno($ruleno) { unlock($cpruleslck); } -/* - * To avoid allocating more ids than needed to a zone need - * to flush them before loading/creating new ruleset - */ -function captiveportal_flush_dn_ruleno($cpzone) { - global $config, $g; - - $cpruleslck = lock("captiveportalrulesdn", LOCK_EX); - if (file_exists("{$g['vardb_path']}/captiveportaldn.rules")) { - $rules = unserialize(file_get_contents("{$g['vardb_path']}/captiveportaldn.rules")); - foreach ($rules as $idx => $zone) { - if ($zone == $cpzone) - $rules[$idx] = false; - } - file_put_contents("{$g['vardb_path']}/captiveportaldn.rules", serialize($rules)); - unset($rules); - } - unlock($cpruleslck); -} - function captiveportal_get_dn_passthru_ruleno($value) { global $config, $g, $cpzone, $cpzoneid; -- cgit v1.1