diff options
author | tedu <> | 2014-04-22 20:31:57 +0000 |
---|---|---|
committer | tedu <> | 2014-04-22 20:31:57 +0000 |
commit | 8d02e1986f2643ed0c05cf3726840f3c5f2486cd (patch) | |
tree | d49a2fea9cd5182996558313f8631378315dad7c /src/lib/libcrypto/asn1/f_string.c | |
parent | 1c26126a31b9d310c9fb3e33570fcbbe14676b11 (diff) | |
download | openbsd-8d02e1986f2643ed0c05cf3726840f3c5f2486cd.tar.gz openbsd-8d02e1986f2643ed0c05cf3726840f3c5f2486cd.tar.bz2 openbsd-8d02e1986f2643ed0c05cf3726840f3c5f2486cd.zip |
fix memory leaks. from Dirk Engling
Diffstat (limited to 'src/lib/libcrypto/asn1/f_string.c')
-rw-r--r-- | src/lib/libcrypto/asn1/f_string.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c index c213c7a88d..14f6554ab3 100644 --- a/src/lib/libcrypto/asn1/f_string.c +++ b/src/lib/libcrypto/asn1/f_string.c | |||
@@ -154,8 +154,6 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
154 | if (sp == NULL) { | 154 | if (sp == NULL) { |
155 | ASN1err(ASN1_F_A2I_ASN1_STRING, | 155 | ASN1err(ASN1_F_A2I_ASN1_STRING, |
156 | ERR_R_MALLOC_FAILURE); | 156 | ERR_R_MALLOC_FAILURE); |
157 | if (s != NULL) | ||
158 | free(s); | ||
159 | goto err; | 157 | goto err; |
160 | } | 158 | } |
161 | s = sp; | 159 | s = sp; |
@@ -187,12 +185,11 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
187 | } | 185 | } |
188 | bs->length = num; | 186 | bs->length = num; |
189 | bs->data = s; | 187 | bs->data = s; |
190 | ret = 1; | 188 | return (1); |
191 | 189 | ||
192 | err: | ||
193 | if (0) { | ||
194 | err_sl: | 190 | err_sl: |
195 | ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE); | 191 | ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE); |
196 | } | 192 | err: |
193 | free(s); | ||
197 | return (ret); | 194 | return (ret); |
198 | } | 195 | } |