diff options
author | 2014-04-22 20:31:57 +0000 | |
---|---|---|
committer | 2014-04-22 20:31:57 +0000 | |
commit | 368ec679405beffabfeeabeee86a82aa75606e99 (patch) | |
tree | d778b2ca72ca123b35c9dc3ff12c137bc0c0b2f1 /lib/libssl/src | |
parent | Remove meat which either duplicates code found in apps/, or is only of value (diff) | |
download | wireguard-openbsd-368ec679405beffabfeeabeee86a82aa75606e99.tar.xz wireguard-openbsd-368ec679405beffabfeeabeee86a82aa75606e99.zip |
fix memory leaks. from Dirk Engling
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_enum.c | 11 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_int.c | 11 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_string.c | 11 |
3 files changed, 12 insertions, 21 deletions
diff --git a/lib/libssl/src/crypto/asn1/f_enum.c b/lib/libssl/src/crypto/asn1/f_enum.c index 98fa3122661..5c42cdff015 100644 --- a/lib/libssl/src/crypto/asn1/f_enum.c +++ b/lib/libssl/src/crypto/asn1/f_enum.c @@ -158,8 +158,6 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE); - if (s != NULL) - free(s); goto err; } s = sp; @@ -191,12 +189,11 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) } bs->length = num; bs->data = s; - ret = 1; + return (1); -err: - if (0) { err_sl: - ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); - } + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); +err: + free(s); return (ret); } diff --git a/lib/libssl/src/crypto/asn1/f_int.c b/lib/libssl/src/crypto/asn1/f_int.c index 3f671d1c490..41e0e752264 100644 --- a/lib/libssl/src/crypto/asn1/f_int.c +++ b/lib/libssl/src/crypto/asn1/f_int.c @@ -162,8 +162,6 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE); - if (s != NULL) - free(s); goto err; } s = sp; @@ -195,12 +193,11 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) } bs->length = num; bs->data = s; - ret = 1; + return (1); -err: - if (0) { err_sl: - ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE); - } + ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE); +err: + free(s); return (ret); } diff --git a/lib/libssl/src/crypto/asn1/f_string.c b/lib/libssl/src/crypto/asn1/f_string.c index c213c7a88d3..14f6554ab33 100644 --- a/lib/libssl/src/crypto/asn1/f_string.c +++ b/lib/libssl/src/crypto/asn1/f_string.c @@ -154,8 +154,6 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE); - if (s != NULL) - free(s); goto err; } s = sp; @@ -187,12 +185,11 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) } bs->length = num; bs->data = s; - ret = 1; + return (1); -err: - if (0) { err_sl: - ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE); - } + ASN1err(ASN1_F_A2I_ASN1_STRING, ASN1_R_SHORT_LINE); +err: + free(s); return (ret); } |