From: Andy Green Date: Mon, 11 Feb 2013 03:27:44 +0000 (+0800) Subject: valgrind drop header allocation down http path X-Git-Tag: accepted/2.0/20130307.220733~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae8a47ecfec16fbf86912722d0d41635e2334d2f;p=profile%2Fivi%2Flibwebsockets.git valgrind drop header allocation down http path Signed-off-by: Andy Green --- diff --git a/lib/handshake.c b/lib/handshake.c index 96e1aba..668dc0d 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -116,15 +116,23 @@ libwebsocket_read(struct libwebsocket_context *context, if (!lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE) || !lws_hdr_total_length(wsi, WSI_TOKEN_CONNECTION)) { wsi->state = WSI_STATE_HTTP; + n = 0; if (wsi->protocol->callback) - if (wsi->protocol->callback(context, wsi, + n = wsi->protocol->callback(context, wsi, LWS_CALLBACK_HTTP, wsi->user_space, lws_hdr_simple_ptr(wsi, WSI_TOKEN_GET_URI), - lws_hdr_total_length(wsi, WSI_TOKEN_GET_URI))) { - lwsl_info("LWS_CALLBACK_HTTP wanted to close\n"); - goto bail; - } + lws_hdr_total_length(wsi, WSI_TOKEN_GET_URI)); + + /* drop the header info */ + if (wsi->u.hdr.ah) + free(wsi->u.hdr.ah); + + if (n) { + lwsl_info("LWS_CALLBACK_HTTP wanted to close\n"); + goto bail; + } + return 0; }