hotspot: fix multiple potential memory leaks
PATCH v3 1/2 hotspot: fix multiple potential memory leaks
--- src/hotspot.c | 4 ++++ 1 file changed, 4 insertions(+)
src/hotspot.c +4 -0
@@ -423,6 +423,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 +455,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
PATCH v3 2/2 hotspot: check if HESSID parses correctly
--- src/hotspot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
src/hotspot.c +5 -1
@@ -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); }
Signature · 1 line
2.17.1
Re: [PATCH v3 2/2] hotspot: check if HESSID parses correctly
Hi James,
Quoted 9 lines · James Prestwood
--- src/hotspot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)src/hotspot.c +0
-0
src/hotspot.c static struct hs20_config *hs20_config_new(struct l_settings *settings, · line 349
Quoted 9 lines
src/hotspot.c +5
-1@@ -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; + } +
This still looks wrong since you're allocating config above
src/hotspot.c static struct hs20_config *hs20_config_new(struct l_settings *settings, · line 352
Quoted 4 lines
src/hotspot.c +0
-0l_free (hessid_str); }
Regards,
-Denis
Denis Kenzior
AppliedHi James,
Quoted 4 lines · James Prestwood
--- src/hotspot.c | 4 ++++ 1 file changed, 4 insertions(+)
Applied, thanks.
Regards,
-Denis