From 7b3acd47b2859203c3f010302e5f1fc199d64b2a Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Fri, 18 May 2018 13:13:20 +0200 Subject: [PATCH] Problem: malloc may fail in blob_t ctors Solution: add alloc_assert calls --- src/blob.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/blob.hpp b/src/blob.hpp index 6abc86dd..b78bfd6c 100644 --- a/src/blob.hpp +++ b/src/blob.hpp @@ -30,6 +30,8 @@ #ifndef __ZMQ_BLOB_HPP_INCLUDED__ #define __ZMQ_BLOB_HPP_INCLUDED__ +#include "err.hpp" + #include #include #include @@ -77,6 +79,7 @@ struct blob_t size_ (size), owned_ (true) { + alloc_assert (data_); } // Creates a blob_t of a given size, an initializes content by copying @@ -86,6 +89,7 @@ struct blob_t size_ (size), owned_ (true) { + alloc_assert (data_); memcpy (data_, data, size_); }