json: fix memleak on OOM

CID 1396083
This commit is contained in:
Lennart Poettering 2018-10-12 18:38:40 +02:00
parent 913c898ca0
commit fcadf032c0
1 changed files with 2 additions and 2 deletions

View File

@ -2560,7 +2560,7 @@ int json_buildv(JsonVariant **ret, va_list ap) {
};
for (;;) {
JsonVariant *add = NULL;
_cleanup_(json_variant_unrefp) JsonVariant *add = NULL;
JsonStack *current;
int command;
@ -2899,7 +2899,7 @@ int json_buildv(JsonVariant **ret, va_list ap) {
goto finish;
}
current->elements[current->n_elements++] = add;
current->elements[current->n_elements++] = TAKE_PTR(add);
}
}