From: Jouni Malinen Date: Wed, 21 Mar 2018 20:34:09 +0000 (+0200) Subject: Fix a resource leak on hostapd maclist parsing error path X-Git-Tag: hostap_2_7~503 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0fa669bcaeb8861cbf24544f18d22a8f39821f1a;p=thirdparty%2Fhostap.git Fix a resource leak on hostapd maclist parsing error path 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 --- diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 8075b6dac..6ba5aae1b 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -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);