aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2014-05-26 17:02:35 +0200
committerSverker Eriksson <sverker@erlang.org>2014-05-26 17:09:54 +0200
commitfb6d7a6e6eacc7767fd5faf262eda6791de44fe7 (patch)
treece4c82a22561affe5f0a29e55ae12524f537ef76 /lib/crypto
parentd282da3510b56313feb7c52e7844880f4d87d088 (diff)
downloadotp-fb6d7a6e6eacc7767fd5faf262eda6791de44fe7.tar.gz
otp-fb6d7a6e6eacc7767fd5faf262eda6791de44fe7.tar.bz2
otp-fb6d7a6e6eacc7767fd5faf262eda6791de44fe7.zip
crypto: Fix memory leak in some error cases
sign(dss,) and compute_key(dh,)
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/c_src/crypto.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index e7fd0c82ec..948093d69c 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -2509,6 +2509,7 @@ static ERL_NIF_TERM dss_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
return enif_make_binary(env, &ret_bin);
}
else {
+ enif_release_binary(&ret_bin);
return atom_error;
}
}
@@ -2771,6 +2772,7 @@ static ERL_NIF_TERM dh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_T
ret = enif_make_binary(env, &ret_bin);
}
else {
+ enif_release_binary(&ret_bin);
ret = atom_error;
}
}