changeset 2494:b62580dc6f30

Fix kmod buffer storage bug
author Michael Pavone <pavone@retrodev.com>
date Sun, 28 Apr 2024 23:18:53 -0700
parents b62336ceb626
children d437b8e8ba62
files vdp.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Wed Apr 17 22:18:45 2024 -0700
+++ b/vdp.c	Sun Apr 28 23:18:53 2024 -0700
@@ -4692,7 +4692,7 @@
 		if (c) {
 			context->kmod_buffer_length++;
 			if ((context->kmod_buffer_length + 1) > context->kmod_buffer_storage) {
-				context->kmod_buffer_storage = context->kmod_buffer_length ? 128 : context->kmod_buffer_length * 2;
+				context->kmod_buffer_storage = context->kmod_buffer_storage ? context->kmod_buffer_storage * 2 : 128;
 				context->kmod_msg_buffer = realloc(context->kmod_msg_buffer, context->kmod_buffer_storage);
 			}
 			context->kmod_msg_buffer[context->kmod_buffer_length - 1] = c;