Quick comment on this one - the change looks quite suspicious, so I would encourage deeper code review. Dynamic memory must be allocated and deallocated using consistent pairs (new/delete, malloc/free, new[]/delete[]).
Mixing new and free is bad practice and can lead to undefined behavior. Even if for simple POD, Plain Old Data, structures it can work fine, for any complex types it may be generally unpredictable.
I have quickly looked at OpenGl_addnames.cxx and see that allocation in AddNamesetAdd() is done view new :
static TStatus AddNamesetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
{
...
data = new TEL_TINT_DATA();
...
((tsm_elem_data)(d.pdata))->pdata = data;
...
}
deallocation (in the patch) via free:
static TStatus AddNamesetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
{
if (data.pdata)
free(data.pdata);
return TSuccess;
}
This is wrong. The better way would be to use
detete reinterpret_cast (data.pdata);
or C-style cast: delete (TEL_TINT_DATA*) (data.pdata);
With that, I would recommend a patch rework. Ideally, it would be good to use the memory checker (like Intel Inspector XE or probably Valgrind) to detect inconsistent behavior.
Hope this helps.
Commenter-1