summaryrefslogtreecommitdiffstats
path: root/src/Buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Buffer.cpp')
-rw-r--r--src/Buffer.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 7cbbe57..aa0ef4c 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#ifdef HAVE_DECL__MM_MALLOC
+#if HAVE_DECL__MM_MALLOC
# include <mm_malloc.h>
#else
# define memalign(a, b) malloc(b)
@@ -73,8 +73,10 @@ void Buffer::setLength(size_t len)
/* Align to 32-byte boundary for AVX. */
data = memalign(32, len);
- memcpy(data, tmp, this->len);
- free(tmp);
+ if (tmp != NULL) {
+ memcpy(data, tmp, this->len);
+ free(tmp);
+ }
size = len;
}
this->len = len;
@@ -97,14 +99,3 @@ void Buffer::appendData(const void *data, size_t len)
}
}
-
-size_t Buffer::getLength()
-{
- return len;
-}
-
-
-void *Buffer::getData()
-{
- return data;
-}