From a277535507728c760210f9c5aaf0ba1ce9971ce4 Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Thu, 29 Nov 2018 13:31:25 +0100 Subject: crypto: Engine valgrind fix Fixes memory leak when a command has wrong type. --- lib/crypto/src/crypto.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/crypto/src/crypto.erl') 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) -> -- cgit v1.2.3