malloc, heapalloc, etc
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Mon Jul 8 17:43:00 CDT 2002
>>>>> "John" == John Lightsey <john at nixnuts.net> writes:
John> Hi all, I've been playing around with the wininet dll to get a
John> windows app I developed running, and I've written a patch that
John> fixes the problems with wininet that I've noticed, but it's an
John> ugly fix and I'd like to get a little clarification about how heap
John> memory is being used in Wine.
John> In dlls/wininet/internet.c InternetOpenUrlA() malloc() is used to
John> put together the HTTP host header in hostreq. The pointer is then
John> passed to HttpAddRequestHeadersA() which creates a buffer with
John> HeapAlloc, copies the contents pointed to by hostreq to it then
John> frees the buffer with HeapFree. Control then passes back to
John> InternetOpenUrlA which does not call free() on the hostreq
John> pointer.
John> So, my question is which is the encouraged way of doing things?
John> HeapAlloc and HeapFree or malloc and free? Also, is the fact that
John> free() was not called on hostreq a bug, or am I missing something?
John> Please be gentle....I'm a Perl programmer, not a C programmer.
If you require memory where there is even a slight chance you expose it to
the application program, use HeapAlloc and friends.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the wine-devel
mailing list