Skip to content

Commit

Permalink
Fix buffer leak in emitClientRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
vadzz-dev committed Dec 27, 2024
1 parent b947011 commit 4d2e19f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shared/helpers/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ alt::MValueByteArray V8Helpers::V8ToRawBytes(v8::Local<v8::Value> val)
if(!serializer.WriteValue(ctx, val).To(&result) || !result) return alt::MValueByteArray();

std::pair<uint8_t*, size_t> 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
Expand Down

0 comments on commit 4d2e19f

Please sign in to comment.