Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/buffer.c | 7 +++++-- dlls/mfplat/tests/mfplat.c | 1 - 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index c45309e1c31..25b71cf79de 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -18,6 +18,8 @@
#define COBJMACROS
+#include <malloc.h> + #include "mfplat_private.h" #include "rtworkq.h"
@@ -173,7 +175,7 @@ static ULONG WINAPI memory_buffer_Release(IMFMediaBuffer *iface) } DeleteCriticalSection(&buffer->cs); free(buffer->_2d.linear_buffer); - free(buffer->data); + _aligned_free(buffer->data); free(buffer); }
@@ -1256,8 +1258,9 @@ static const IMFDXGIBufferVtbl dxgi_buffer_vtbl = static HRESULT memory_buffer_init(struct buffer *buffer, DWORD max_length, DWORD alignment, const IMFMediaBufferVtbl *vtbl) { - if (!(buffer->data = calloc(1, ALIGN_SIZE(max_length, alignment)))) + if (!(buffer->data = _aligned_malloc(ALIGN_SIZE(max_length, alignment), alignment + 1))) return E_OUTOFMEMORY; + memset(buffer->data, 0, ALIGN_SIZE(max_length, alignment));
buffer->IMFMediaBuffer_iface.lpVtbl = vtbl; buffer->refcount = 1; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 0d86f041c1e..67e81ff0821 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -2279,7 +2279,6 @@ static void test_system_memory_buffer(void) hr = IMFMediaBuffer_Lock(buffer, &data, &max, &length); ok(hr == S_OK, "Failed to lock, hr %#x.\n", hr); ok(max == 201 && length == 10, "Unexpected length.\n"); - todo_wine ok(((uintptr_t)data & MF_512_BYTE_ALIGNMENT) == 0, "Data at %p is insufficiently aligned.\n", data); hr = IMFMediaBuffer_Unlock(buffer); ok(hr == S_OK, "Failed to unlock, hr %#x.\n", hr);