diff --git a/libretro-common/formats/libchdr/libchdr_lzma.c b/libretro-common/formats/libchdr/libchdr_lzma.c index c947b16298..25fabe3cf4 100644 --- a/libretro-common/formats/libchdr/libchdr_lzma.c +++ b/libretro-common/formats/libchdr/libchdr_lzma.c @@ -88,7 +88,7 @@ static void *lzma_fast_alloc(void *p, size_t size) } /* alloc a new one and put it into the list */ - addr = (uint32_t *)malloc(sizeof(uint32_t) * (size + sizeof(uint32_t))); + addr = (uint32_t *)malloc(sizeof(uint32_t) * size + sizeof(uintptr_t)); if (!addr) return NULL; diff --git a/libretro-common/formats/libchdr/libchdr_zlib.c b/libretro-common/formats/libchdr/libchdr_zlib.c index 6e4a5dea7d..7e6fe19ac8 100644 --- a/libretro-common/formats/libchdr/libchdr_zlib.c +++ b/libretro-common/formats/libchdr/libchdr_zlib.c @@ -263,7 +263,7 @@ voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size) } /* alloc a new one */ - ptr = (UINT32 *)malloc(size + sizeof(UINT32)); + ptr = (UINT32 *)malloc(size + sizeof(uintptr_t)); if (!ptr) return NULL;