Slightly improve behaviour under low memory conditions.
authorCarl Hetherington <cth@carlh.net>
Fri, 11 Mar 2022 22:35:08 +0000 (23:35 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 17 Mar 2022 21:20:33 +0000 (22:20 +0100)
src/lib/emailer.cc

index f5812f0c20867eef7e79265c0862d2b400f29569..f906f5a8b320917515fef25db9ad343b0f575c09 100644 (file)
@@ -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);