From 0474686514ac2ba80b352792b034eec63ca6886e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 30 Dec 2009 22:37:23 +0200 Subject: [PATCH] Fix couple of memory leaks in wpa_config_get_all() --- wpa_supplicant/config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 692b52f27..da56dc8e3 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1860,12 +1860,18 @@ char ** wpa_config_get_all(struct wpa_ssid *ssid, int get_keys) if (field->key_data && !get_keys) continue; value = field->writer(field, ssid); - if (value == NULL || os_strlen(value) == 0) + if (value == NULL) continue; + if (os_strlen(value) == 0) { + os_free(value); + continue; + } key = os_strdup(field->name); - if (key == NULL) + if (key == NULL) { + os_free(value); goto err; + } props[fields_num * 2] = key; props[fields_num * 2 + 1] = value;