Remove invalid vector item heap alloc

Fixes #3986
This commit is contained in:
rw 2016-08-20 20:33:36 -07:00
parent f0d91fa143
commit c4ba502f57
2 changed files with 0 additions and 9 deletions

View File

@ -288,9 +288,6 @@ static void GetMemberOfVectorOfStruct(const StructDef &struct_def,
if (!(vectortype.struct_def->fixed)) { if (!(vectortype.struct_def->fixed)) {
code += "\t\tx = rcv._tab.Indirect(x)\n"; code += "\t\tx = rcv._tab.Indirect(x)\n";
} }
code += "\t\tif obj == nil {\n";
code += "\t\t\tobj = new(" + TypeName(field) + ")\n";
code += "\t\t}\n";
code += "\t\tobj.Init(rcv._tab.Bytes, x)\n"; code += "\t\tobj.Init(rcv._tab.Bytes, x)\n";
code += "\t\treturn true\n\t}\n"; code += "\t\treturn true\n\t}\n";
code += "\treturn false\n"; code += "\treturn false\n";

View File

@ -131,9 +131,6 @@ func (rcv *Monster) Test4(obj *Test, j int) bool {
if o != 0 { if o != 0 {
x := rcv._tab.Vector(o) x := rcv._tab.Vector(o)
x += flatbuffers.UOffsetT(j) * 4 x += flatbuffers.UOffsetT(j) * 4
if obj == nil {
obj = new(Test)
}
obj.Init(rcv._tab.Bytes, x) obj.Init(rcv._tab.Bytes, x)
return true return true
} }
@ -173,9 +170,6 @@ func (rcv *Monster) Testarrayoftables(obj *Monster, j int) bool {
x := rcv._tab.Vector(o) x := rcv._tab.Vector(o)
x += flatbuffers.UOffsetT(j) * 4 x += flatbuffers.UOffsetT(j) * 4
x = rcv._tab.Indirect(x) x = rcv._tab.Indirect(x)
if obj == nil {
obj = new(Monster)
}
obj.Init(rcv._tab.Bytes, x) obj.Init(rcv._tab.Bytes, x)
return true return true
} }