diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_dec.c')
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 76fc023230..2426cb6253 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -691,6 +691,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl | |||
691 | 691 | ||
692 | int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it) | 692 | int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it) |
693 | { | 693 | { |
694 | ASN1_VALUE **opval = NULL; | ||
694 | ASN1_STRING *stmp; | 695 | ASN1_STRING *stmp; |
695 | ASN1_TYPE *typ = NULL; | 696 | ASN1_TYPE *typ = NULL; |
696 | int ret = 0; | 697 | int ret = 0; |
@@ -705,6 +706,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char | |||
705 | *pval = (ASN1_VALUE *)typ; | 706 | *pval = (ASN1_VALUE *)typ; |
706 | } else typ = (ASN1_TYPE *)*pval; | 707 | } else typ = (ASN1_TYPE *)*pval; |
707 | if(utype != typ->type) ASN1_TYPE_set(typ, utype, NULL); | 708 | if(utype != typ->type) ASN1_TYPE_set(typ, utype, NULL); |
709 | opval = pval; | ||
708 | pval = (ASN1_VALUE **)&typ->value.ptr; | 710 | pval = (ASN1_VALUE **)&typ->value.ptr; |
709 | } | 711 | } |
710 | switch(utype) { | 712 | switch(utype) { |
@@ -796,7 +798,12 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char | |||
796 | 798 | ||
797 | ret = 1; | 799 | ret = 1; |
798 | err: | 800 | err: |
799 | if(!ret) ASN1_TYPE_free(typ); | 801 | if(!ret) |
802 | { | ||
803 | ASN1_TYPE_free(typ); | ||
804 | if (opval) | ||
805 | *opval = NULL; | ||
806 | } | ||
800 | return ret; | 807 | return ret; |
801 | } | 808 | } |
802 | 809 | ||