Skip to content

Commit

Permalink
dns_server: fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
pymumu committed Oct 23, 2023
1 parent 62171f2 commit 95c79ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,13 +1462,13 @@ static int _dns_cache_cname_packet(struct dns_server_post_context *context)
return -1;
}

cache_packet = dns_cache_new_data_packet(inpacket_buff, inpacket_len);
if (cache_packet == NULL) {
if (context->qtype != DNS_T_A && context->qtype != DNS_T_AAAA) {
return -1;
}

if (context->qtype != DNS_T_A && context->qtype != DNS_T_AAAA) {
return -1;
cache_packet = dns_cache_new_data_packet(inpacket_buff, inpacket_len);
if (cache_packet == NULL) {
goto errout;
}

ttl = _dns_server_get_conf_ttl(request, request->ip_ttl);
Expand Down Expand Up @@ -1511,7 +1511,7 @@ static int _dns_cache_packet(struct dns_server_post_context *context)

struct dns_cache_data *cache_packet = dns_cache_new_data_packet(context->inpacket, context->inpacket_len);
if (cache_packet == NULL) {
return -1;
goto errout;
}

/* if doing prefetch, update cache only */
Expand Down

0 comments on commit 95c79ce

Please sign in to comment.