Skip to contentSkip to conversation

util: guard against NULL 'freqs' in scan_freq_set_free

PATCH Applied James Prestwood 2 participants 2 messages Aug 5, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 util: guard against NULL 'freqs' in scan_freq_set_free

Since this can be used with the _auto_ macro it must be able to handle a NULL input for error paths.

---
 src/util.c | 3 +++
 1 file changed, 3 insertions(+)
src/util.c +3 -0
index dfee77fa..d564ebc0 100644
@@ -330,6 +330,9 @@ struct scan_freq_set *scan_freq_set_new(void)
 
 void scan_freq_set_free(struct scan_freq_set *freqs)
 {
+	if (!freqs)
+		return;
+
 	l_uintset_free(freqs->channels_5ghz);
 	l_uintset_free(freqs->channels_6ghz);
 	l_free(freqs);
Signature · 1 line
2.34.3
#1 lore raw

Hi James,

Quoted 6 lines · James Prestwood

Since this can be used with the _auto_ macro it must be able to handle a NULL input for error paths.

---
  src/util.c | 3 +++
  1 file changed, 3 insertions(+)

Applied, thanks.

Regards,
-Denis