Loading crypto/asn1/asn1_lib.c +2 −1 Original line number Diff line number Diff line Loading @@ -363,6 +363,7 @@ void ASN1_STRING_free(ASN1_STRING *a) return; if (!(a->flags & ASN1_STRING_FLAG_NDEF)) OPENSSL_free(a->data); if (!(a->flags & ASN1_STRING_FLAG_EMBED)) OPENSSL_free(a); } Loading crypto/asn1/tasn_new.c +14 −6 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); Loading Loading @@ -120,12 +121,12 @@ int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) if (it->templates) { if (!asn1_template_new(pval, it->templates)) goto memerr; } else if (!asn1_primitive_new(pval, it)) } else if (!asn1_primitive_new(pval, it, embed)) goto memerr; break; case ASN1_ITYPE_MSTRING: if (!asn1_primitive_new(pval, it)) if (!asn1_primitive_new(pval, it, embed)) goto memerr; break; Loading Loading @@ -305,7 +306,8 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) * all the old functions. */ static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) { ASN1_TYPE *typ; ASN1_STRING *str; Loading Loading @@ -347,10 +349,16 @@ static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) break; default: if (embed) { str = *(ASN1_STRING **)pval; memset(str, 0, sizeof(*str)); str->flags = ASN1_STRING_FLAG_EMBED; } else { str = ASN1_STRING_type_new(utype); *pval = (ASN1_VALUE *)str; } if (it->itype == ASN1_ITYPE_MSTRING && str) str->flags |= ASN1_STRING_FLAG_MSTRING; *pval = (ASN1_VALUE *)str; break; } if (*pval) Loading include/openssl/asn1.h +2 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ DECLARE_STACK_OF(X509_ALGOR) * type. */ # define ASN1_STRING_FLAG_MSTRING 0x040 /* String is embedded and only content should be freed */ # define ASN1_STRING_FLAG_EMBED 0x080 /* This is the base type that holds just about everything :-) */ struct asn1_string_st { int length; Loading Loading
crypto/asn1/asn1_lib.c +2 −1 Original line number Diff line number Diff line Loading @@ -363,6 +363,7 @@ void ASN1_STRING_free(ASN1_STRING *a) return; if (!(a->flags & ASN1_STRING_FLAG_NDEF)) OPENSSL_free(a->data); if (!(a->flags & ASN1_STRING_FLAG_EMBED)) OPENSSL_free(a); } Loading
crypto/asn1/tasn_new.c +14 −6 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); Loading Loading @@ -120,12 +121,12 @@ int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) if (it->templates) { if (!asn1_template_new(pval, it->templates)) goto memerr; } else if (!asn1_primitive_new(pval, it)) } else if (!asn1_primitive_new(pval, it, embed)) goto memerr; break; case ASN1_ITYPE_MSTRING: if (!asn1_primitive_new(pval, it)) if (!asn1_primitive_new(pval, it, embed)) goto memerr; break; Loading Loading @@ -305,7 +306,8 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) * all the old functions. */ static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) { ASN1_TYPE *typ; ASN1_STRING *str; Loading Loading @@ -347,10 +349,16 @@ static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) break; default: if (embed) { str = *(ASN1_STRING **)pval; memset(str, 0, sizeof(*str)); str->flags = ASN1_STRING_FLAG_EMBED; } else { str = ASN1_STRING_type_new(utype); *pval = (ASN1_VALUE *)str; } if (it->itype == ASN1_ITYPE_MSTRING && str) str->flags |= ASN1_STRING_FLAG_MSTRING; *pval = (ASN1_VALUE *)str; break; } if (*pval) Loading
include/openssl/asn1.h +2 −0 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ DECLARE_STACK_OF(X509_ALGOR) * type. */ # define ASN1_STRING_FLAG_MSTRING 0x040 /* String is embedded and only content should be freed */ # define ASN1_STRING_FLAG_EMBED 0x080 /* This is the base type that holds just about everything :-) */ struct asn1_string_st { int length; Loading