Skip to contentSkip to conversation

hotspot: fix multiple potential memory leaks

PATCH Superseded James Prestwood 1 participant 1 message Oct 16, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hotspot: fix multiple potential memory leaks

---
 src/hotspot.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-v2:
* Just fail if HESSID doesn't parse

src/hotspot.c +9 -1
index 20ebb2fd..e3a7a07a 100644
@@ -342,7 +342,11 @@ static struct hs20_config *hs20_config_new(struct l_settings *settings,
 	config = l_new(struct hs20_config, 1);
 
 	if (hessid_str) {
-		util_string_to_address(hessid_str, config->hessid);
+		if (!util_string_to_address(hessid_str, config->hessid)) {
+			l_error("Invalid HESSID in settings");
+			goto free_values;
+		}
+
 		l_free(hessid_str);
 	}
 
@@ -423,6 +427,8 @@ static void hs20_dir_watch_cb(const char *filename,
 
 		l_queue_push_head(hs20_settings, config);
 
+		l_settings_free(new);
+
 		break;
 	case L_DIR_WATCH_EVENT_REMOVED:
 		config = l_queue_remove_if(hs20_settings, match_filename,
@@ -453,6 +459,8 @@ static void hs20_dir_watch_cb(const char *filename,
 
 		known_network_update(&config->super, new, connected_time);
 
+		l_settings_free(new);
+
 		break;
 	case L_DIR_WATCH_EVENT_ACCESSED:
 		break;
Signature · 1 line
2.17.1