MBO: Fix possible memory leak in anqp_send_req()

In case that an mbo object is allocated, but there is a failure
to resize the wpabuf, need to free the mbo object.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Ilan Peer 2017-06-08 11:17:58 +03:00 committed by Jouni Malinen
parent e4e99927bf
commit 422570eec8

View file

@ -2738,6 +2738,7 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst,
if (mbo) { if (mbo) {
if (wpabuf_resize(&extra_buf, wpabuf_len(mbo))) { if (wpabuf_resize(&extra_buf, wpabuf_len(mbo))) {
wpabuf_free(extra_buf); wpabuf_free(extra_buf);
wpabuf_free(mbo);
return -1; return -1;
} }
wpabuf_put_buf(extra_buf, mbo); wpabuf_put_buf(extra_buf, mbo);