Commit 3602d54a authored by Sergey Lyubka's avatar Sergey Lyubka

Better check for NULL in mg_connect()

parent 8428f362
...@@ -3981,7 +3981,7 @@ struct mg_connection *mg_connect(struct mg_context *ctx, ...@@ -3981,7 +3981,7 @@ struct mg_connection *mg_connect(struct mg_context *ctx,
struct hostent *he; struct hostent *he;
int sock; int sock;
if (ctx->client_ssl_ctx == NULL && use_ssl) { if (use_ssl && (ctx == NULL || ctx->client_ssl_ctx == NULL)) {
cry(fc(ctx), "%s: SSL is not initialized", __func__); cry(fc(ctx), "%s: SSL is not initialized", __func__);
} else if ((he = gethostbyname(host)) == NULL) { } else if ((he = gethostbyname(host)) == NULL) {
cry(fc(ctx), "%s: gethostbyname(%s): %s", __func__, host, strerror(ERRNO)); cry(fc(ctx), "%s: gethostbyname(%s): %s", __func__, host, strerror(ERRNO));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment