From 0663ec5470edcbaa9db24180c30e38fb7f74f216 Mon Sep 17 00:00:00 2001 From: Brett Anthony Date: Tue, 2 Mar 2021 22:11:35 -0700 Subject: [PATCH] Fixes #1 --- xTGA/src/codecs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xTGA/src/codecs.cpp b/xTGA/src/codecs.cpp index 5ada192..f43ad1d 100644 --- a/xTGA/src/codecs.cpp +++ b/xTGA/src/codecs.cpp @@ -2260,8 +2260,8 @@ bool xtga::codecs::DecodeImage(const void* buffer, void*& obuffer, flags::IMAGEO if (!obuffer) { - obuffer = (uchar*)malloc((addressable)w * h * depth); - for (addressable i = 0; i < (addressable)w * h * depth; ++i) + obuffer = (uchar*)malloc((addressable)w * h * depth / 8); + for (addressable i = 0; i < (addressable)w * h * depth / 8; ++i) { ((uchar*)obuffer)[i] = ((uchar*)buffer)[i]; }