[PATCHv2] Fix a couple memory leaks

Paul Stewart pstew
Fri Jul 13 11:30:24 PDT 2012


Found using valgrind.

Signed-hostap: Paul Stewart <pstew at chromium.org>
---
 src/drivers/driver_nl80211.c            |    5 ++++-
 wpa_supplicant/dbus/dbus_new_handlers.c |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0373f43..75cd669 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8444,12 +8444,15 @@ static int nl80211_signal_monitor(void *priv, int threshold, int hysteresis)
 
 	cqm = nlmsg_alloc();
 	if (cqm == NULL)
-		return -1;
+		goto nla_put_failure;
 
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_THOLD, threshold);
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_HYST, hysteresis);
 	nla_put_nested(msg, NL80211_ATTR_CQM, cqm);
 
+	nlmsg_free(cqm);
+	cqm = NULL;
+
 	if (send_and_recv_msgs(drv, msg, NULL, NULL) == 0)
 		return 0;
 	msg = NULL;
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 8145a70..3f895cf 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -609,6 +609,7 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
 out:
 	os_free(driver);
 	os_free(ifname);
+	os_free(confname);
 	os_free(bridge_ifname);
 	return reply;
 
-- 
1.7.7.3




More information about the Hostap mailing list