Instead of constructing a custom error handler freeing the same set of
allocated memory areas on various error cases, share the success path
freeing implementation for the error cases as well.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
int stationary = 0;
int bss_parameters = 0;
char *tmp;
- int ret;
+ int ret = -1;
if (!(hapd->conf->radio_measurements[0] &
WLAN_RRM_CAPS_NEIGHBOR_REPORT)) {
if (!lci) {
wpa_printf(MSG_ERROR,
"CTRL: SET_NEIGHBOR: Bad LCI subelement");
- wpabuf_free(nr);
- return -1;
+ goto fail;
}
}
if (!civic) {
wpa_printf(MSG_ERROR,
"CTRL: SET_NEIGHBOR: Bad civic subelement");
- wpabuf_free(nr);
- wpabuf_free(lci);
- return -1;
+ goto fail;
}
}
if (bss_parameters < 0 || bss_parameters > 0xff) {
wpa_printf(MSG_ERROR,
"CTRL: SET_NEIGHBOR: Bad bss_parameters subelement");
- wpabuf_free(nr);
- wpabuf_free(lci);
- wpabuf_free(civic);
- return -1;
+ goto fail;
}
}
ret = hostapd_neighbor_set(hapd, bssid, &ssid, nr, lci, civic,
stationary, bss_parameters);
+fail:
wpabuf_free(nr);
wpabuf_free(lci);
wpabuf_free(civic);