YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Memory Leak - please confirm
Supertim
#1 Posted : Wednesday, October 19, 2016 6:16:29 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/1/2016(UTC)
Posts: 4

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Greetings,

It appears that there may be a memory leak in the CreateDefaultDelegate routine if the error condition is met.

Please take a look:
File: https://github.com/alber...er/squirrel/sqstate.cpp
Lines: 84-85
Condition: if error condition is met - NULL is returned, but SQTable *t (line 79) and SQNativeClosure *nc (line 81) and SQString nc->_name (line 83) never get deallocated, resulting in leaks.

Could you please confirm whether this assessment is accurate? I am tempted to fix this by releasing the native closure and the table before returning NULL (which will in turn free the string _name), but wanted to confirm that my speculation is correct before taking matters into my own hands.

Thanks!
fagiano
#2 Posted : Saturday, October 22, 2016 5:34:03 PM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,054

Thanks: 0 times
Was thanked: 77 time(s) in 59 post(s)
Yes, good catch, that would create a leak. However, that is internal vm code that is extensively tested so is not really ever going to fail( theoretically :D ). I'd say replacing that with an assert() is the best solution, It should never fail as is part of the vm code. anyway we can't recover from that failure.

thank you

ciao
Alberto
Follow me on Twitter @squirrellang
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.072 seconds.