From 07f3f6c956e01d30427c502c0af7c66c8441be5c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 11 Mar 2022 23:35:08 +0100 Subject: [PATCH] Slightly improve behaviour under low memory conditions. --- src/lib/emailer.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/emailer.cc b/src/lib/emailer.cc index f5812f0c2..f906f5a8b 100644 --- a/src/lib/emailer.cc +++ b/src/lib/emailer.cc @@ -161,8 +161,14 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str "Content-Disposition: attachment; filename=" + i.name + "\r\n\r\n"; auto b64 = BIO_new (BIO_f_base64()); + if (!b64) { + throw std::bad_alloc(); + } auto bio = BIO_new (BIO_s_mem()); + if (!bio) { + throw std::bad_alloc(); + } bio = BIO_push (b64, bio); ArrayData data (i.file); -- 2.30.2