From 4d2e19f1fa409ce2a26d7b112f0e568e87d255f4 Mon Sep 17 00:00:00 2001 From: vadzz Date: Fri, 27 Dec 2024 17:55:52 +0300 Subject: [PATCH] Fix buffer leak in emitClientRaw --- shared/helpers/Serialization.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/helpers/Serialization.cpp b/shared/helpers/Serialization.cpp index 5275f905..7f16b8d2 100644 --- a/shared/helpers/Serialization.cpp +++ b/shared/helpers/Serialization.cpp @@ -528,7 +528,10 @@ alt::MValueByteArray V8Helpers::V8ToRawBytes(v8::Local val) if(!serializer.WriteValue(ctx, val).To(&result) || !result) return alt::MValueByteArray(); std::pair serialized = serializer.Release(); - return alt::ICore::Instance().CreateMValueByteArray(serialized.first, serialized.second); + auto mvArray = alt::ICore::Instance().CreateMValueByteArray(serialized.first, serialized.second); + + delegate.FreeBufferMemory(serialized.first); + return mvArray; } // Converts a MValue byte array to a JS value