diff options
author | Stefan Metzmacher <metze@samba.org> | 2021-12-24 01:52:32 +0100 |
---|---|---|
committer | Joseph Sutton <jsutton@samba.org> | 2022-01-19 20:50:35 +0000 |
commit | 40b65c840e03bd5eb7f3b02fe80144650c63c005 (patch) | |
tree | d11b9bf5bcf1c71c0696d2153489447d47d03a0e /source4/heimdal/lib/asn1/gen_free.c | |
parent | d2a3016a9c59f93f89cf4bb86d40938d56400453 (diff) | |
download | samba-40b65c840e03bd5eb7f3b02fe80144650c63c005.tar.gz |
s4:heimdal: import lorikeet-heimdal-202201172009 (commit 5a0b45cd723628b3690ea848548b05771c40f14e)
See
https://git.samba.org/?p=lorikeet-heimdal.git;a=shortlog;h=refs/heads/lorikeet-heimdal-202201172009
or
https://gitlab.com/samba-team/devel/lorikeet-heimdal/-/tree/lorikeet-heimdal-202201172009
NOTE: THIS COMMIT WON'T COMPILE/WORK ON ITS OWN!
Pair-Programmed-With: Joseph Sutton <josephsutton@catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Diffstat (limited to 'source4/heimdal/lib/asn1/gen_free.c')
-rw-r--r-- | source4/heimdal/lib/asn1/gen_free.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source4/heimdal/lib/asn1/gen_free.c b/source4/heimdal/lib/asn1/gen_free.c index b9cae7533b1..6c9424cbf35 100644 --- a/source4/heimdal/lib/asn1/gen_free.c +++ b/source4/heimdal/lib/asn1/gen_free.c @@ -63,7 +63,7 @@ free_type (const char *name, const Type *t, int preserve) case TUTCTime: break; case TBitString: - if (ASN1_TAILQ_EMPTY(t->members)) + if (HEIM_TAILQ_EMPTY(t->members)) free_primitive("bit_string", name); break; case TOctetString: @@ -83,7 +83,7 @@ free_type (const char *name, const Type *t, int preserve) if(t->type == TChoice) fprintf(codefile, "switch((%s)->element) {\n", name); - ASN1_TAILQ_FOREACH(m, t->members, members) { + HEIM_TAILQ_FOREACH(m, t->members, members) { char *s; if (m->ellipsis){ @@ -119,7 +119,7 @@ free_type (const char *name, const Type *t, int preserve) have_ellipsis->label, name, have_ellipsis->gen_name); fprintf(codefile, "}\n"); - } + } break; } case TSetOf: @@ -179,6 +179,8 @@ void generate_type_free (const Symbol *s) { int preserve = preserve_type(s->name) ? TRUE : FALSE; + int deco_opt; + char *ft, *fn; fprintf (codefile, "void ASN1CALL\n" "free_%s(%s *data)\n" @@ -186,6 +188,19 @@ generate_type_free (const Symbol *s) s->gen_name, s->gen_name); free_type ("data", s->type, preserve); + if (decorate_type(s->gen_name, &ft, &fn, &deco_opt)) { + if (deco_opt) { + fprintf(codefile, "if ((data)->%s) {\n", fn); + fprintf(codefile, "free_%s((data)->%s);\n", ft, fn); + fprintf(codefile, "free((data)->%s);\n", fn); + fprintf(codefile, "(data)->%s = NULL;\n", fn); + fprintf(codefile, "}\n"); + } else { + fprintf(codefile, "free_%s(&(data)->%s);\n", ft, fn); + } + free(ft); + free(fn); + } fprintf (codefile, "}\n\n"); } |