aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cryptobox.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 17:17:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-10 17:17:09 +0100
commit6e31344466e2558a99cd46bb29abaa37e1faffc6 (patch)
treeae51cd2a56c252d6f0df6755b76719fe121e81e3 /src/lua/lua_cryptobox.c
parentc4d3eb4af41a17cf28cb4fbb171d9b70d98259b5 (diff)
downloadrspamd-6e31344466e2558a99cd46bb29abaa37e1faffc6.tar.gz
rspamd-6e31344466e2558a99cd46bb29abaa37e1faffc6.zip
[Minor] Fix compile warnings
Diffstat (limited to 'src/lua/lua_cryptobox.c')
-rw-r--r--src/lua/lua_cryptobox.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index 645b2495f..518ae9389 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -2321,6 +2321,16 @@ lua_cryptobox_gen_dkim_keypair (lua_State *L)
/* Process private key */
rc = i2d_RSAPrivateKey_bio (mbio, r);
+
+ if (rc == 0) {
+ BIO_free (mbio);
+ BN_free (e);
+ RSA_free (r);
+ EVP_PKEY_free (pk);
+
+ return luaL_error (L, "i2d_RSAPrivateKey_bio failed");
+ }
+
len = BIO_get_mem_data (mbio, &data);
b64_data = rspamd_encode_base64 (data, len, -1, &b64_len);
@@ -2334,6 +2344,16 @@ lua_cryptobox_gen_dkim_keypair (lua_State *L)
/* Process public key */
BIO_reset (mbio);
rc = i2d_RSA_PUBKEY_bio (mbio, r);
+
+ if (rc == 0) {
+ BIO_free (mbio);
+ BN_free (e);
+ RSA_free (r);
+ EVP_PKEY_free (pk);
+
+ return luaL_error (L, "i2d_RSA_PUBKEY_bio failed");
+ }
+
len = BIO_get_mem_data (mbio, &data);
b64_data = rspamd_encode_base64 (data, len, -1, &b64_len);