Skip to content

Commit

Permalink
sd-journal: use TAKE_PTR() a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
mrc0mmand committed May 24, 2023
1 parent ac874b8 commit f32e44e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/libsystemd/sd-journal/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/resolve/resolved-dns-rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f32e44e

Please sign in to comment.