malloc, heapalloc, etc

John Lightsey john at nixnuts.net
Mon Jul 8 07:48:08 CDT 2002


Hi all,

I've been playing around with the wininet dll to get a windows app I developed 
running, and I've written a patch that fixes the problems with wininet that 
I've noticed, but it's an ugly fix and I'd like to get a little clarification 
about how heap memory is being used in Wine.

In dlls/wininet/internet.c InternetOpenUrlA() malloc() is used to put together 
the HTTP host header in hostreq.  The pointer is then passed to 
HttpAddRequestHeadersA() which creates a buffer with HeapAlloc, copies the 
contents pointed to by hostreq to it then frees the buffer with HeapFree.  
Control then passes back to InternetOpenUrlA which does not call free() on 
the hostreq pointer.

So, my question is which is the encouraged way of doing things?  HeapAlloc and 
HeapFree or malloc and free?  Also, is the fact that free() was not called on 
hostreq a bug, or am I missing something?

Please be gentle....I'm a Perl programmer, not a C programmer.



More information about the wine-devel mailing list