mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fixed a small memory leak if love.physics.newChainShape errors
This commit is contained in:
@@ -149,16 +149,24 @@ int Physics::newChainShape(lua_State *L)
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
|
||||
if (loop)
|
||||
s->CreateLoop(vecs, vcount);
|
||||
else
|
||||
s->CreateChain(vecs, vcount);
|
||||
try
|
||||
{
|
||||
if (loop)
|
||||
s->CreateLoop(vecs, vcount);
|
||||
else
|
||||
s->CreateChain(vecs, vcount);
|
||||
}
|
||||
catch (love::Exception &)
|
||||
{
|
||||
delete[] vecs;
|
||||
throw;
|
||||
}
|
||||
|
||||
ChainShape *c = new ChainShape(s);
|
||||
delete[] vecs;
|
||||
|
||||
luax_pushtype(L, "ChainShape", PHYSICS_CHAIN_SHAPE_T, c);
|
||||
ChainShape *c = new ChainShape(s);
|
||||
|
||||
luax_pushtype(L, "ChainShape", PHYSICS_CHAIN_SHAPE_T, c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user