aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2018-09-12 09:58:32 +0200
committerHans Nilsson <[email protected]>2018-09-12 09:58:32 +0200
commitc6be7937fcedfc02d96904c2d194b5e74b730b0b (patch)
treef12a5011b1a3c70aee6ee884d6ebcb622836e05f /lib/crypto
parent8c0534e76ff75f44599b32965e18c5a1bf6959aa (diff)
parentad0cf7f078cf05d0b75fd233491d2b51bb1dcf23 (diff)
downloadotp-c6be7937fcedfc02d96904c2d194b5e74b730b0b.tar.gz
otp-c6be7937fcedfc02d96904c2d194b5e74b730b0b.tar.bz2
otp-c6be7937fcedfc02d96904c2d194b5e74b730b0b.zip
Merge branch 'maint'
* maint: crypto: Fix valgrind error
Diffstat (limited to 'lib/crypto')
-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
}