diff --git a/client/client_shared.c b/client/client_shared.c index b82d6c24..caa33e18 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -924,6 +924,10 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url) port[len] = '\0'; }else{ host = malloc(len + 1); + if(!host){ + fprintf(stderr, "Error: Out of memory.\n"); + goto cleanup; + } memcpy(host, &(str[start]), len); host[len] = '\0'; }