diff --git a/fuzzer/avc_dec_fuzzer.cpp b/fuzzer/avc_dec_fuzzer.cpp index 3b00175..35dbca8 100644 --- a/fuzzer/avc_dec_fuzzer.cpp +++ b/fuzzer/avc_dec_fuzzer.cpp @@ -18,7 +18,6 @@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore */ -#include #include #include #include @@ -49,8 +48,12 @@ enum { const static int kSupportedColorFormats = NELEMENTS(supportedColorFormats); const static int kMaxCores = 4; void *iv_aligned_malloc(void *ctxt, WORD32 alignment, WORD32 size) { + void *buf = NULL; (void)ctxt; - return memalign(alignment, size); + if (0 != posix_memalign(&buf, alignment, size)) { + return NULL; + } + return buf; } void iv_aligned_free(void *ctxt, void *buf) { @@ -217,7 +220,7 @@ void Codec::allocFrame() { mOutBufHandle.u4_num_bufs = num_bufs; for (int i = 0; i < num_bufs; i++) { mOutBufHandle.u4_min_out_buf_size[i] = sizes[i]; - mOutBufHandle.pu1_bufs[i] = (UWORD8 *)memalign(16, sizes[i]); + mOutBufHandle.pu1_bufs[i] = (UWORD8 *)iv_aligned_malloc(NULL, 16, sizes[i]); } } void Codec::decodeHeader(const uint8_t *data, size_t size) { diff --git a/test/decoder/main.c b/test/decoder/main.c index ea7fca3..4c4d445 100644 --- a/test/decoder/main.c +++ b/test/decoder/main.c @@ -44,9 +44,6 @@ #include #endif -#ifndef IOS -#include -#endif #ifdef IOS_DISPLAY #include "cast_types.h" #else @@ -447,8 +444,13 @@ void ih264a_aligned_free(void *pv_ctxt, void *pv_buf) #if (!defined(IOS)) && (!defined(_WIN32)) void * ih264a_aligned_malloc(void *pv_ctxt, WORD32 alignment, WORD32 i4_size) { - (void)pv_ctxt; - return memalign(alignment, i4_size); + void *buf = NULL; + (void)pv_ctxt; + if (0 != posix_memalign(&buf, alignment, i4_size)) + { + return NULL; + } + return buf; } void ih264a_aligned_free(void *pv_ctxt, void *pv_buf) diff --git a/test/encoder/main.c b/test/encoder/main.c index 15261df..9d130da 100644 --- a/test/encoder/main.c +++ b/test/encoder/main.c @@ -29,10 +29,6 @@ #include #include -#ifndef IOS -#include -#endif - #ifdef WINDOWS_TIMER #include "windows.h" #else @@ -277,7 +273,12 @@ void ih264a_aligned_free(void *pv_buf) void * ih264a_aligned_malloc(WORD32 alignment, WORD32 size) { - return memalign(alignment, size); + void *buf = NULL; + if (0 != posix_memalign(&buf, alignment, size)) + { + return NULL; + } + return buf; } void ih264a_aligned_free(void *pv_buf)