mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Problem: malloc may fail in blob_t ctors
Solution: add alloc_assert calls
This commit is contained in:
parent
9da0c6d62f
commit
7b3acd47b2
@ -30,6 +30,8 @@
|
||||
#ifndef __ZMQ_BLOB_HPP_INCLUDED__
|
||||
#define __ZMQ_BLOB_HPP_INCLUDED__
|
||||
|
||||
#include "err.hpp"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
@ -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_);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user