Open Bug 369401 Opened 19 years ago Updated 3 years ago

MAPIReadMail() produces memory leaks, MAPIFreeBuffer() does nothing

Categories

(MailNews Core :: Simple MAPI, defect)

x86
Windows XP
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: christian.franke, Unassigned)

References

Details

(Keywords: memory-leak)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 Build Identifier: MAPIFreeBuffer() does not free anything. As a consequence, MAPIReadMail() produces memory leaks in programs using mozMapi32.dll. Reproducible: Always Steps to Reproduce: 1. Open MAPI session with MAPILogon(). 2. Call MAPIReadMail(hSession, hWnd, msgid, 0, 0, &pMsg) for some mail. 3. Call MAPIFreeBuffer(pMsg). 4. Repeat 2 and 3 many times. 5. Examine calling program's memory consumption in task manager. Actual Results: Memory is not freed by MAPIFreeBuffer(). Expected Results: MAPIFreeBuffer() should free memory allocated by MAPIReadMail(). MAPIFreeBuffer() does actually nothing because the memArray is always null: http://lxr.mozilla.org/seamonkey/source/mailnews/mapi/mapiDll/MapiDll.cpp#411 This is because SetPointerArray() in line 78 is never called. But even calling SetPointerArray() IMO would not help. Then MAPIFreeBuffer() would call mozMapi32.dll::free() on memory allocated by CoTaskMemAlloc() inside of MapiProxy.dll. This likely would crash the program using MAPI. The comment in line 71 of MapiDll.cpp: "// this can't be right." is probably right:-) MAPIFreeBuffer() shall call a function in MapiProxy.dll which frees the memory using CoTaskMemFree().
i don't suppose you could post a patch to fix this? (cvs diff -up8 preferred)
Keywords: mlk
Product: Core → MailNews Core
Sid any chance to look at this one ?
Severity: normal → minor
Christian would you be willing to make a patch ?
Removing myslef on all the bugs I'm cced on. Please NI me if you need something on MailNews Core bugs from me.
See Also: → 1521380
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.