diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2016-12-19 15:21:08 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2016-12-19 15:21:08 -0800 |
commit | c66683f27fbb4a6af70d3ff708e2c7f37cee0c60 (patch) | |
tree | cf284c97fb783c1eb7e6b1ca37cd367a9c8fdb1b /tests/GoTest.sh | |
parent | d1e8899310d8e8758d9900628de448a3a43bd050 (diff) | |
download | flatbuffers-c66683f27fbb4a6af70d3ff708e2c7f37cee0c60.tar.gz flatbuffers-c66683f27fbb4a6af70d3ff708e2c7f37cee0c60.tar.bz2 flatbuffers-c66683f27fbb4a6af70d3ff708e2c7f37cee0c60.zip |
Add ::Set function to Unions to make memory ownership clear.
Unions own the NativeTable* value member because they need to destroy them
when the Union goes out of scope. Currently, the data is destroyed by calling
delete, which means that the member needs to be allocated with new. However,
making the allocation the responsibility of the client and the destruction
the responsibility of the Union can lead to potential errors. Adding a
Set function will ensure that the memory is allocated correctly so that it
can be deleted later.
From cl/142161569.
Change-Id: I4605f26d2749164819bfae0140e5fae08442b50a
Diffstat (limited to 'tests/GoTest.sh')
0 files changed, 0 insertions, 0 deletions