sd-journal: use TAKE_PTR() a bit more

This commit is contained in:
Frantisek Sumsal
2023-05-23 19:21:20 +02:00
parent ac874b8fb1
commit f32e44e467
2 changed files with 6 additions and 5 deletions

View File

@@ -171,7 +171,8 @@ static int finish_item(
if (ordered_hashmap_update(h, i, combined) < 0)
return log_oom();
combined = NULL;
TAKE_PTR(combined);
free(prev);
} else {
/* A new item */
@@ -181,8 +182,9 @@ static int finish_item(
if (ordered_hashmap_put(h, i, combined) < 0)
return log_oom();
i = NULL;
combined = NULL;
TAKE_PTR(i);
TAKE_PTR(combined);
}
return 0;

View File

@@ -1229,12 +1229,11 @@ int dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical) {
assert(packet._data);
free(rr->wire_format);
rr->wire_format = packet._data;
rr->wire_format = TAKE_PTR(packet._data);
rr->wire_format_size = packet.size;
rr->wire_format_rdata_offset = rds;
rr->wire_format_canonical = canonical;
packet._data = NULL;
dns_packet_unref(&packet);
return 0;