lib/asn1: generate_type_free heim_release not heim_retain

Do not leak the object when the intent is to free it.

Introduced by 40d1271094
("asn1: Expand decoration w/ C types")

Change-Id: If8cd502f61d6f9b72118630839525933911c6697
This commit is contained in:
Nicolas Williams
2022-01-28 12:15:28 -05:00
committed by Jeffrey Altman
parent 4185e87a6c
commit a835b9053d

View File

@@ -191,7 +191,7 @@ generate_type_free (const Symbol *s)
free_type ("data", s->type, preserve);
while (decorate_type(s->gen_name, &deco, &more_deco)) {
if (deco.heim_object) {
fprintf(codefile, "heim_retain((data)->%s);\n", deco.field_name);
fprintf(codefile, "heim_release((data)->%s);\n", deco.field_name);
fprintf(codefile, "(data)->%s = 0;\n", deco.field_name);
} else if (deco.ext && deco.free_function_name == NULL) {
/* Decorated with field of external type but no free function */