aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2018-09-12 09:58:07 +0200
committerHans Nilsson <[email protected]>2018-09-12 09:58:07 +0200
commitad0cf7f078cf05d0b75fd233491d2b51bb1dcf23 (patch)
tree033c7e4f1e26caecbe21bd0704883925b868c572
parentb9dfc9f6e728e82e727b9f8920a4f0b85f4b0003 (diff)
parent46ddd7939820a48f72aa980ff2a1728cf935d4c3 (diff)
downloadotp-ad0cf7f078cf05d0b75fd233491d2b51bb1dcf23.tar.gz
otp-ad0cf7f078cf05d0b75fd233491d2b51bb1dcf23.tar.bz2
otp-ad0cf7f078cf05d0b75fd233491d2b51bb1dcf23.zip
Merge branch 'hans/crypto/valgrind' into maint
* hans/crypto/valgrind: crypto: Fix valgrind error
-rw-r--r--lib/crypto/c_src/crypto.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 550342a88d..c7f36c95f1 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -5203,7 +5203,10 @@ static ERL_NIF_TERM pkey_crypt_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM
unsigned char *p;
if (rsa == NULL) goto badarg;
tmplen = RSA_size(rsa);
- if (!enif_alloc_binary(tmplen, &tmp_bin)) goto badarg;
+ if (!enif_alloc_binary(tmplen, &tmp_bin)) {
+ RSA_free(rsa);
+ goto badarg;
+ }
p = out_bin.data;
p++;
i = RSA_padding_check_SSLv23(tmp_bin.data, tmplen, p, out_bin.size - 1, tmplen);
@@ -5214,6 +5217,7 @@ static ERL_NIF_TERM pkey_crypt_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM
tmp_bin = in_bin;
i = 1;
}
+ RSA_free(rsa);
}
#endif
}