[racket] Possible memory leak in MysterX

From: José Lopes (jose.lopes at ist.utl.pt)
Date: Wed Mar 2 12:23:56 EST 2011

I think the following code can lead to memory leak because 
doTypeDescFromTypeInfo might call scheme_signal_error

static
MX_TYPEDESC *typeDescFromTypeInfo(LPCTSTR name, INVOKEKIND invKind,
                                   ITypeInfo *pITypeInfo)
{
   BSTR unicodeName;
   MX_TYPEDESC *retval;

   unicodeName = textToBSTR(name, strlen(name));
   retval = doTypeDescFromTypeInfo(unicodeName, invKind, pITypeInfo);

   SysFreeString(unicodeName);

   return retval;
}

There should be some construct similar to try...catch...finally using 
the scheme_* primitives surrounding the call to doTypeDescFromTypeInfo 
and SysFreeString.

Regards,
José Lopes

-- 
José António Branquinho de Oliveira Lopes
58612 - MEIC-A
jose.lopes at ist.utl.pt



Posted on the users mailing list.