More memory bugs


Subject: More memory bugs
From: Mike Nordell (tamlin@algonet.se)
Date: Sun Mar 18 2001 - 00:41:15 CST


Instead of just quietly fixing this, I had to go on ranting about it.

ev_Menu_Labels.cpp v. 1.16 got a nasty bug. Potentially a killer if left
as-is. Even Dom that updated that file to 1.17 missed that bug. May I humbly
suggest that if using strings in this way, and don't know the difference
between malloc/calloc & new, use the string class UT_String I added.

I've apparently forgotten how challanging memory management can be to some,
why I after seeing this bug reintroduced for the 4711:th time suggests that
this micro-management of memory should be forwarded to some entity that ease
the burden off you: UT_String. I actually think we should throw
UT_cloneString away and never look back.

Even _if_ UT_cloneString would have used new[] to allocate the memory
returned this would corrupt the heap and crash (if _lucky_ that is) since
DELETEP uses _plain_ "delete", not the vector version.

/Mike - don't cc



This archive was generated by hypermail 2b25 : Sun Mar 18 2001 - 00:39:12 CST