Skip to content

Commit b525170

Browse files
committed
dns_client: fix memory leak
1 parent adeb3e8 commit b525170

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/dns_client.c

+4
Original file line numberDiff line numberDiff line change
@@ -3183,6 +3183,7 @@ static int _dns_client_verify_common_name(struct dns_server_info *server_info, X
31833183
tlog(TLOG_DEBUG, "peer SAN: %s", dns->data);
31843184
if (_dns_client_tls_matchName(tls_host_verify, (char *)dns->data, dns->length) == 0) {
31853185
tlog(TLOG_DEBUG, "peer SAN match: %s", dns->data);
3186+
GENERAL_NAMES_free(alt_names);
31863187
return 0;
31873188
}
31883189
} break;
@@ -3196,6 +3197,9 @@ static int _dns_client_verify_common_name(struct dns_server_info *server_info, X
31963197
errout:
31973198
tlog(TLOG_WARN, "server %s CN is invalid, peer CN: %s, expect CN: %s", server_info->ip, peer_CN, tls_host_verify);
31983199
server_info->prohibit = 1;
3200+
if (alt_names) {
3201+
GENERAL_NAMES_free(alt_names);
3202+
}
31993203
return -1;
32003204
}
32013205

0 commit comments

Comments
 (0)