diff options
author | Maneesh Jain <maneesh.jain@samsung.com> | 2015-06-18 18:47:25 +0530 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-06-22 15:10:43 +0300 |
commit | 999ef16639cd0a6e4941243f44d260d76422b0f8 (patch) | |
tree | 7de36d2e50c566e09b42a03795087166285ad0b9 /gsupplicant | |
parent | 9e9d25792e76c3b3e5cc66d67bba34c059dcaec1 (diff) | |
download | connman-999ef16639cd0a6e4941243f44d260d76422b0f8.tar.gz |
gsupplicant: Fix possible memory leak in g_supplicant_set_country()
In case supplicant_dbus_property_set() function returns error, 'regdom'
memory is not freed.
Diffstat (limited to 'gsupplicant')
-rwxr-xr-x | gsupplicant/supplicant.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index fb62a97a..38cbad1e 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -3273,6 +3273,7 @@ int g_supplicant_set_country(const char *alpha2, const void *user_data) { struct supplicant_regdom *regdom; + int ret; SUPPLICANT_DBG("Country setting %s", alpha2); @@ -3287,10 +3288,15 @@ int g_supplicant_set_country(const char *alpha2, regdom->alpha2 = alpha2; regdom->user_data = user_data; - return supplicant_dbus_property_set(SUPPLICANT_PATH, SUPPLICANT_INTERFACE, + ret = supplicant_dbus_property_set(SUPPLICANT_PATH, SUPPLICANT_INTERFACE, "Country", DBUS_TYPE_STRING_AS_STRING, country_params, country_result, regdom, NULL); + if (ret < 0) { + dbus_free(regdom); + SUPPLICANT_DBG("Unable to set Country configuration"); + } + return ret; } int g_supplicant_interface_set_country(GSupplicantInterface *interface, |