From 8f80007bcc94faae7c369d4ed8a07a9d35c31c72 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 1 Oct 2017 02:42:24 +0300 Subject: [PATCH] fix underalloc --- pico/sek.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pico/sek.c b/pico/sek.c index 8bf0341..5176528 100644 --- a/pico/sek.c +++ b/pico/sek.c @@ -302,7 +302,8 @@ void SekRegisterIdleHit(unsigned int pc) void SekInitIdleDet(void) { - unsigned short **tmp = realloc(idledet_ptrs, 0x200*4); + unsigned short **tmp; + tmp = realloc(idledet_ptrs, 0x200 * sizeof(tmp[0])); if (tmp == NULL) { free(idledet_ptrs); idledet_ptrs = NULL; @@ -410,7 +411,8 @@ int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop, void *ctx) } if (idledet_count >= 0x200 && (idledet_count & 0x1ff) == 0) { - unsigned short **tmp = realloc(idledet_ptrs, (idledet_count+0x200)*4); + unsigned short **tmp; + tmp = realloc(idledet_ptrs, (idledet_count+0x200) * sizeof(tmp[0])); if (tmp == NULL) return 1; idledet_ptrs = tmp; -- 2.39.2