Re: memory leak with lineGetID



camera wrote:

How is a question about TAPI relevant in a group focused on
WMM? Use <news:microsoft.public.win32.programmer.tapi>.

> I have a program which is reporting a memory leak here
> but I have not determined why. Does it looks fine?? It
> works.

A memory leak does not prevent a program from running and it
is not a problem once the process terminates but, as long as
the program runs, it will progressively consume memory.

> LPVARSTRING pVarString = NULL;
> pVarString =
> (LPVARSTRING)LocalAlloc(LPTR, BIGBUFF);
>
> LEAK IS HERE => if (lRet = lineGetID(0, 0, hCall,
> LINECALLSELECT_CALL, pVarString, TEXT("wave/in")))

You didn't properly initialize

pVarString->dwTotalSize = BIGBUFF;

May that's what causes lineGetID() to leak memory.

You should read the documentation about lineGetID():

<<<
Prior to calling lineGetID, the application should set the
dwTotalSize member of this structure to indicate the amount
of memory available to TAPI for returning information.
>>>


--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net



.