From: Andy Green Date: Mon, 12 Dec 2016 12:41:05 +0000 (+0800) Subject: client: avoid possible NULL deref on error path X-Git-Tag: upstream/1.7.9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fupstream_210817;p=platform%2Fupstream%2Flibwebsockets.git client: avoid possible NULL deref on error path https://github.com/warmcat/libwebsockets/issues/672 --- diff --git a/lib/client-handshake.c b/lib/client-handshake.c index f78f4f19..904f6ecd 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -311,8 +311,11 @@ lws_client_connect_2(struct lws *wsi) oom4: /* we're closing, losing some rx is OK */ - wsi->u.hdr.ah->rxpos = wsi->u.hdr.ah->rxlen; + if (wsi->u.hdr.ah) + wsi->u.hdr.ah->rxpos = wsi->u.hdr.ah->rxlen; + lws_header_table_detach(wsi); + /* take care that we might be inserted in fds already */ if (wsi->position_in_fds_table != -1) goto failed;