Do not leak in mg_connect_ws_opt()

PUBLISHED_FROM=e6de3b3747a1cd79c3930c2640fadc8356ffed61
This commit is contained in:
Sergey Lyubka 2016-06-15 12:50:09 +01:00 committed by Cesanta Bot
parent a67323fc12
commit f9d0ad9dc3

View File

@ -7779,12 +7779,10 @@ struct mg_connection *mg_connect_ws_opt(struct mg_mgr *mgr,
struct mg_connection *nc = mg_connect_http_base(
mgr, ev_handler, opts, "ws://", "wss://", url, &path, &addr);
if (nc == NULL) {
return NULL;
if (nc != NULL) {
mg_send_websocket_handshake2(nc, path, addr, protocol, extra_headers);
}
mg_send_websocket_handshake2(nc, path, addr, protocol, extra_headers);
MG_FREE(addr);
return nc;
}