[PATCH] Fix memory leak on invalid interface error path

Jouni Malinen j
Fri Dec 17 03:57:27 PST 2010


On Fri, Dec 10, 2010 at 11:48:04AM +0900, Masashi Honma wrote:
> The hostapd produces following error messages when I specify
> nonexistent interface name to hostapd.conf "interface=" field.

Thanks for reporting this.

> WPA_TRACE: Freeing referenced memory - START
> [3]: ./hostapd() [0x8083c93]
>      i802_init() ../src/drivers/driver_nl80211.c:5484

> This patch solves this issue.
> 
> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -1927,7 +1927,8 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
> -	linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr);
> +	if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr))
> +		return -1;

The real problem was in the error path not deinitializing resources. I
fixed that in a separate commit. However, I did apply this one as well.
I do not want to apply the second patch you sent because that would make
hostapd depend on sysfs being mounted which may not be the case on all
systems.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list