Commit 7b3acd47 authored by Simon Giesecke's avatar Simon Giesecke

Problem: malloc may fail in blob_t ctors

Solution: add alloc_assert calls
parent 9da0c6d6
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#ifndef __ZMQ_BLOB_HPP_INCLUDED__ #ifndef __ZMQ_BLOB_HPP_INCLUDED__
#define __ZMQ_BLOB_HPP_INCLUDED__ #define __ZMQ_BLOB_HPP_INCLUDED__
#include "err.hpp"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <algorithm> #include <algorithm>
...@@ -77,6 +79,7 @@ struct blob_t ...@@ -77,6 +79,7 @@ struct blob_t
size_ (size), size_ (size),
owned_ (true) owned_ (true)
{ {
alloc_assert (data_);
} }
// Creates a blob_t of a given size, an initializes content by copying // Creates a blob_t of a given size, an initializes content by copying
...@@ -86,6 +89,7 @@ struct blob_t ...@@ -86,6 +89,7 @@ struct blob_t
size_ (size), size_ (size),
owned_ (true) owned_ (true)
{ {
alloc_assert (data_);
memcpy (data_, data, size_); memcpy (data_, data, size_);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment