1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

resolve: fix memleak

Fixes a bug introduced by 71aee23dba.

Fixes CID#1488763.
This commit is contained in:
Yu Watanabe 2022-05-14 15:09:11 +09:00 committed by Luca Boccassi
parent 618b3642e1
commit 6530ca0d2b

View File

@ -69,7 +69,7 @@ static int dns_answer_reserve_internal(DnsAnswer *a, size_t n) {
DnsAnswer *dns_answer_new(size_t n) {
_cleanup_ordered_set_free_ OrderedSet *s = NULL;
DnsAnswer *a;
_cleanup_(dns_answer_unrefp) DnsAnswer *a = NULL;
if (n > UINT16_MAX)
n = UINT16_MAX;
@ -90,7 +90,7 @@ DnsAnswer *dns_answer_new(size_t n) {
if (dns_answer_reserve_internal(a, n) < 0)
return NULL;
return a;
return TAKE_PTR(a);
}
static DnsAnswer *dns_answer_free(DnsAnswer *a) {