mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-12 20:59:03 +08:00
Better check for NULL in mg_connect()
This commit is contained in:
parent
8428f362c1
commit
3602d54a5b
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user