]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix a resource leak on hostapd maclist parsing error path
authorJouni Malinen <jouni@codeaurora.org>
Wed, 21 Mar 2018 20:34:09 +0000 (22:34 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 21 Mar 2018 20:34:09 +0000 (22:34 +0200)
The open file needs to be closed in error case. The conversion to using
a new helper function (hostapd_add_acl_maclist) somehow managed to
remove the neede fclose(f) call. Bring it back to fix this.

Fixes: 3988046de538 ("hostapd: Dynamic MAC ACL management over control interface")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/config_file.c

index 8075b6dac9ff27bc726887d1d6618797ec2e495c..6ba5aae1b39e05a8223228096c411b346bad9284 100644 (file)
@@ -217,8 +217,10 @@ static int hostapd_config_read_maclist(const char *fname,
                if (*pos != '\0')
                        vlan_id = atoi(pos);
 
-               if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0)
+               if (hostapd_add_acl_maclist(acl, num, vlan_id, addr) < 0) {
+                       fclose(f);
                        return -1;
+               }
        }
 
        fclose(f);