From: Masashi Honma Date: Wed, 26 Aug 2009 20:34:54 +0000 (+0300) Subject: WPS: Aggregate deinit calls in WPS OOB X-Git-Tag: hostap_0_7_0~205 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe23eb56963f98418c86b3e26a8bd0c79b5c49b2;p=thirdparty%2Fhostap.git WPS: Aggregate deinit calls in WPS OOB In WPS OOB, deinit_func() is called from 3 locations. This patch aggregates these to one. --- diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c index 65b7d99ca..7cc63e176 100644 --- a/src/wps/wps_common.c +++ b/src/wps/wps_common.c @@ -496,25 +496,23 @@ int wps_process_oob(struct wps_context *wps, struct oob_device_data *oob_dev, ret = -1; } else { data = oob_dev->read_func(oob_priv); - if (data == NULL) { - oob_dev->deinit_func(oob_priv); - return -1; + if (data == NULL) + ret = -1; + else { + if (oob_method == OOB_METHOD_CRED) + ret = wps_parse_oob_cred(wps, data); + else + ret = wps_parse_oob_dev_pwd(wps, data); } - - if (oob_method == OOB_METHOD_CRED) - ret = wps_parse_oob_cred(wps, data); - else - ret = wps_parse_oob_dev_pwd(wps, data); } wpabuf_free(data); + oob_dev->deinit_func(oob_priv); + if (ret < 0) { wpa_printf(MSG_ERROR, "WPS: Failed to process OOB data"); - oob_dev->deinit_func(oob_priv); return -1; } - oob_dev->deinit_func(oob_priv); - return 0; }