From b625655439f08d888da2218aedc49a5919d78f6d Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Thu, 17 Aug 2023 18:09:53 +0000 Subject: [PATCH] Fix memory leak in some generated code. --- Cytoplasm/tools/j2s.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cytoplasm/tools/j2s.c b/Cytoplasm/tools/j2s.c index fe3bde8..b4bcdd9 100644 --- a/Cytoplasm/tools/j2s.c +++ b/Cytoplasm/tools/j2s.c @@ -1009,6 +1009,10 @@ Main(Array * args) StreamPrintf(implFile, " for (i = 0; i < ArraySize(val->%s); i++)\n", key); StreamPrintf(implFile, " {\n"); StreamPrintf(implFile, " %sFree(ArrayGet(val->%s, i));\n", (!isEnum && !isPrimitive) ? fieldType : "", key); + if (!isEnum && !isPrimitive) + { + StreamPrintf(implFile, " Free(ArrayGet(val->%s, i));\n", key); + } StreamPrintf(implFile, " }\n"); StreamPrintf(implFile, " ArrayFree(val->%s);\n", key); StreamPrintf(implFile, " }\n");