From bbdd5105b1d140c9f635d8aabcbde7e36c8908f8 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 7 May 2009 08:59:09 +0200 Subject: [PATCH] Allocated memory with the wrong size resulting in invalid memory access. --- src/common/mm_io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index fbbe96150..a15933f29 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -938,11 +938,11 @@ mm_mem_io_c::mm_mem_io_c(unsigned char *_mem, if (increase <= 0) throw error_c(Y("wrong usage: increase < 0")); - if ((mem == NULL) && (increase > 0)) { + if ((NULL == mem) && (0 < increase)) { if (0 == mem_size) allocated = increase; - mem = (unsigned char *)safemalloc(increase); + mem = (unsigned char *)safemalloc(allocated); free_mem = true; } else