Skip to content

Commit

Permalink
fix some bugs with memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Dec 10, 2023
1 parent b6834fa commit 1f5ea10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/heimdal/lib/asn1/gen_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ free_type (const char *name, const Type *t, int preserve)
case TNull:
case TGeneralizedTime:
case TUTCTime:
/*
* This doesn't do much, but it leaves zeros where garbage might
* otherwise have been found. Gets us closer to having the equivalent
* of a memset()-to-zero data structure after calling the free
* functions.
*/
fprintf(codefile, "*%s = 0;\n", name);
break;
case TBitString:
if (ASN1_TAILQ_EMPTY(t->members))
Expand Down
1 change: 1 addition & 0 deletions crypto/heimdal/lib/asn1/gen_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ generate_template(const Symbol *s)
"int\n"
"decode_%s(const unsigned char *p, size_t len, %s *data, size_t *size)\n"
"{\n"
" memset(data, 0, sizeof(*data));\n"
" return _asn1_decode_top(asn1_%s, 0|%s, p, len, data, size);\n"
"}\n"
"\n",
Expand Down

0 comments on commit 1f5ea10

Please sign in to comment.