From: Andy Green Date: Wed, 13 Jan 2016 10:48:50 +0000 (+0800) Subject: remove double free attempts from no ACCEPT server response cleanup path X-Git-Tag: upstream/1.7.3~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=389a4bb9f0cd125cdc0a21b09bb0cb1fca1d7224;p=platform%2Fupstream%2Flibwebsockets.git remove double free attempts from no ACCEPT server response cleanup path The generic wsi close code is smart enough to clean up after these allocations itself Signed-off-by: Andy Green --- diff --git a/lib/client.c b/lib/client.c index 344cf6f..40c2391 100644 --- a/lib/client.c +++ b/lib/client.c @@ -527,18 +527,18 @@ lws_client_interpret_server_handshake(struct lws *wsi) * Now let's confirm it sent all the necessary headers */ + p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP); + if (!p) { + lwsl_info("no URI\n"); + goto bail3; + } + if (lws_hdr_total_length(wsi, WSI_TOKEN_ACCEPT) == 0) { lwsl_info("no ACCEPT\n"); - p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP); isErrorCodeReceived = 1; goto bail3; } - p = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP); - if (!p) { - lwsl_info("no URI\n"); - goto bail3; - } if (p && strncmp(p, "101", 3)) { lwsl_warn( "lws_client_handshake: got bad HTTP response '%s'\n", p); @@ -852,7 +852,6 @@ check_accept: return 0; bail3: - lws_free_set_NULL(wsi->u.ws.rx_ubuf); close_reason = LWS_CLOSE_STATUS_NOSTATUS; bail2: @@ -871,8 +870,7 @@ bail2: lwsl_info("closing connection due to bail2 connection error\n"); - /* free up his parsing allocations */ - lws_free_header_table(wsi); + /* closing will free up his parsing allocations */ lws_close_free_wsi(wsi, close_reason); return 1;