Skip to content
Snippets Groups Projects
Commit 90d4524a authored by Chris Broekema's avatar Chris Broekema
Browse files

Bug #1011: check posix_memalign return values

parent 8a7fad02
No related branches found
No related tags found
No related merge requests found
...@@ -120,7 +120,9 @@ inline void StreamableData::write(Stream *str, bool withSequenceNumber, unsigned ...@@ -120,7 +120,9 @@ inline void StreamableData::write(Stream *str, bool withSequenceNumber, unsigned
void *sn_buf; void *sn_buf;
uint32_t sn = sequenceNumber; uint32_t sn = sequenceNumber;
posix_memalign(&sn_buf, align, align); if (posix_memalign(&sn_buf, align, align) != 0) {
THROW(InterfaceException,"could not allocate data");
}
try { try {
dataConvert(BigEndian, &sn, 1); dataConvert(BigEndian, &sn, 1);
...@@ -144,7 +146,9 @@ inline void StreamableData::write(Stream *str, bool withSequenceNumber, unsigned ...@@ -144,7 +146,9 @@ inline void StreamableData::write(Stream *str, bool withSequenceNumber, unsigned
if (align < sizeof(uint32_t)) THROW(AssertError, "Sizeof alignment < sizeof sequencenumber"); if (align < sizeof(uint32_t)) THROW(AssertError, "Sizeof alignment < sizeof sequencenumber");
void *sn_buf; void *sn_buf;
posix_memalign(&sn_buf, align, align); if (posix_memalign(&sn_buf, align, align) != 0) {
THROW(InterfaceException,"could not allocate data");
}
try { try {
memcpy(sn_buf, &sequenceNumber, sizeof sequenceNumber); memcpy(sn_buf, &sequenceNumber, sizeof sequenceNumber);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment