base: Fix use-after-free db.c (mostly unused in prod)

We only use `db` for an2ln testing.
This commit is contained in:
Nicolas Williams
2023-01-03 20:22:32 -06:00
parent c05294e2c5
commit 23a9ca27a5

View File

@@ -1505,11 +1505,12 @@ json_db_sync(void *db, heim_error_t *error)
json = heim_json_copy_serialize(jsondb->dict, 0, &e);
if (json == NULL) {
ret = heim_error_get_code(e);
if (error)
*error = e;
else
heim_release(e);
return heim_error_get_code(e);
return ret;
}
json_text = heim_string_get_utf8(json);