Skip to content

Commit

Permalink
shared/json: fix another memleak in normalization
Browse files Browse the repository at this point in the history
(cherry picked from commit 3b6ce05)
Related: #2087652
  • Loading branch information
keszybz authored and systemd-rhel-bot committed Jun 14, 2022
1 parent 03795a6 commit 6e0d847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -4621,7 +4621,7 @@ int json_variant_sort(JsonVariant **v) {

int json_variant_normalize(JsonVariant **v) {
_cleanup_free_ JsonVariant **a = NULL;
JsonVariant *n = NULL;
_cleanup_(json_variant_unrefp) JsonVariant *n = NULL;
size_t i, m;
int r;

Expand Down Expand Up @@ -4669,7 +4669,7 @@ int json_variant_normalize(JsonVariant **v) {
goto finish;
}

JSON_VARIANT_REPLACE(*v, n);
JSON_VARIANT_REPLACE(*v, TAKE_PTR(n));

r = 1;

Expand Down
1 change: 1 addition & 0 deletions test/fuzz/fuzz-json/leak-normalize-object
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[7,7,7,7,{"":7,"":7,"^t":7,"-":7},2777,7,7,7,3]

0 comments on commit 6e0d847

Please sign in to comment.