Fix wrong return value from LUKS2_generate_hdr on error.

On rare occasion (low memory) the function could return success
even though LUKS2 json metadata could be assembled properly.
This commit is contained in:
Ondrej Kozina
2023-05-24 17:46:06 +02:00
parent 716cf78da6
commit 11d8c58c72

View File

@@ -360,6 +360,7 @@ int LUKS2_generate_hdr(
if (json_object_object_add_by_uint(jobj_segments, 0, jobj_segment)) { if (json_object_object_add_by_uint(jobj_segments, 0, jobj_segment)) {
json_object_put(jobj_segment); json_object_put(jobj_segment);
r = -ENOMEM;
goto err; goto err;
} }