From 0fa669bcaeb8861cbf24544f18d22a8f39821f1a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 21 Mar 2018 22:34:09 +0200 Subject: [PATCH] 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 --- hostapd/config_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);