diff options
author | assar <assar@FreeBSD.org> | 2001-06-21 02:12:07 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-06-21 02:12:07 +0000 |
commit | 0c8fa354358381b3f1b92598e7f1b46f8cf744cc (patch) | |
tree | ed28ffb73cc0ae48a9892dab3f10b09bc36436d5 /crypto/heimdal/lib/asn1/gen_decode.c | |
parent | 06c859ecf534f468a52f24a3eb14409d73a4907c (diff) | |
download | FreeBSD-src-0c8fa354358381b3f1b92598e7f1b46f8cf744cc.zip FreeBSD-src-0c8fa354358381b3f1b92598e7f1b46f8cf744cc.tar.gz |
import of heimdal 0.3f
Diffstat (limited to 'crypto/heimdal/lib/asn1/gen_decode.c')
-rw-r--r-- | crypto/heimdal/lib/asn1/gen_decode.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crypto/heimdal/lib/asn1/gen_decode.c b/crypto/heimdal/lib/asn1/gen_decode.c index bed19a9..9303698 100644 --- a/crypto/heimdal/lib/asn1/gen_decode.c +++ b/crypto/heimdal/lib/asn1/gen_decode.c @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_decode.c,v 1.15 2001/01/29 08:36:45 assar Exp $"); +RCSID("$Id: gen_decode.c,v 1.16 2001/02/10 18:14:38 assar Exp $"); static void decode_primitive (const char *typename, const char *name) @@ -281,7 +281,7 @@ generate_type_decode (const Symbol *s) s->gen_name, s->gen_name); fprintf (codefile, "#define FORW " - "if(e) return e; " + "if(e) goto fail; " "p += l; " "len -= l; " "ret += l\n\n"); @@ -308,13 +308,19 @@ generate_type_decode (const Symbol *s) "size_t ret = 0, reallen;\n" "size_t l;\n" "int i, e;\n\n"); - fprintf(codefile, "i = 0;\n"); /* hack to avoid `unused variable' */ - fprintf(codefile, "reallen = 0;\n"); /* hack to avoid `unused variable' */ + fprintf (codefile, "memset(data, 0, sizeof(*data));\n"); + fprintf (codefile, "i = 0;\n"); /* hack to avoid `unused variable' */ + fprintf (codefile, "reallen = 0;\n"); /* hack to avoid `unused variable' */ decode_type ("data", s->type); fprintf (codefile, "if(size) *size = ret;\n" "return 0;\n"); + fprintf (codefile, + "fail:\n" + "free_%s(data);\n" + "return e;\n", + s->gen_name); break; default: abort (); |