When wpa_supplicant is compiled with CONFIG_TESTING_OPTIONS and receives
a FLUSH command from wpa_cli, p2p_ctrl_flush() may crash due to passing
a NULL pointer into p2p_set_invitation_op_freq().
Add a NULL pointer check, similar to the other NULL pointer check
already in p2p_ctrl_flush().
Fixes: 475f50d71001 ("P2P2: Allow op class and channel override for Invitation Response")
Signed-off-by: Dan Callaghan <dan.callaghan@morsemicro.com>
#ifdef CONFIG_TESTING_OPTIONS
os_free(wpa_s->get_pref_freq_list_override);
wpa_s->get_pref_freq_list_override = NULL;
- p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
+ if (wpa_s->global->p2p)
+ p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
#endif /* CONFIG_TESTING_OPTIONS */
wpas_p2p_stop_find(wpa_s);