aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src/crypto.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2018-11-29 13:31:25 +0100
committerHans Nilsson <[email protected]>2018-12-03 10:17:36 +0100
commita277535507728c760210f9c5aaf0ba1ce9971ce4 (patch)
tree53131053c356619d29cc919c9b9ef73bd2735dcc /lib/crypto/src/crypto.erl
parent7cb434ca64c08269c1d4837e0133d1ef2e20bb6e (diff)
downloadotp-a277535507728c760210f9c5aaf0ba1ce9971ce4.tar.gz
otp-a277535507728c760210f9c5aaf0ba1ce9971ce4.tar.bz2
otp-a277535507728c760210f9c5aaf0ba1ce9971ce4.zip
crypto: Engine valgrind fix
Fixes memory leak when a command has wrong type.
Diffstat (limited to 'lib/crypto/src/crypto.erl')
-rw-r--r--lib/crypto/src/crypto.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index af53a72e16..72cb9aabfd 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -1224,7 +1224,11 @@ engine_load_1(Engine, PreCmds, PostCmds, EngineMethods) ->
throw:Error ->
%% The engine couldn't initialise, release the structural reference
ok = engine_free_nif(Engine),
- throw(Error)
+ throw(Error);
+ error:badarg ->
+ %% For example bad argument list, release the structural reference
+ ok = engine_free_nif(Engine),
+ error(badarg)
end.
engine_load_2(Engine, PostCmds, EngineMethods) ->