staging: rtl8723bs: avoid null pointer dereference on pmlmepriv

There is a check to see if pmlmepriv is null before vfree'ing
pmlmepriv->free_bss_buf hence implying pmlmepriv could potenially be
null. However, a previous call to rtw_free_mlme_priv_ie_data
can also dereference pmlmepriv, so move this call so that it is only
called if pmlmepriv non-null.

Detected by CoverityScan, CID#1077739 ("Dereference before null check")

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Colin Ian King and committed by Greg Kroah-Hartman ec141219 c51b46dd

+1 -2
+1 -2
drivers/staging/rtl8723bs/core/rtw_mlme.c
··· 119 119 120 120 void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) 121 121 { 122 - rtw_free_mlme_priv_ie_data(pmlmepriv); 123 - 124 122 if (pmlmepriv) { 123 + rtw_free_mlme_priv_ie_data(pmlmepriv); 125 124 if (pmlmepriv->free_bss_buf) { 126 125 vfree(pmlmepriv->free_bss_buf); 127 126 }