[Wine] HeapAlloc vs. malloc. How does HeapAlloc work?

Ove Kaaven ovek at arcticnet.no
Tue Apr 22 05:07:00 CDT 2008


Petr Svoboda skrev:
> I am little bit interested in Wine source code. There is one thing I don't understand. How does HeapAlloc() work? Is it the same behavior as Winapi HeapAlloc()?

Yes.

> If so then I have to check NULL value after each calling of this function, don't I?

Yes. You have to do that with malloc() too, so why "vs malloc"?

> Nobody is checking NULL value of include_defs and later there is strcpy() with HeapAlloc as parameter.

Well, it's the age-old hazards of programming in C: people get lazy 
about error checking, which has caused various problems in all kinds of 
software. (In this case, perhaps thinking that if you're out of memory, 
then you're in so much trouble anyway that the null-pointer-dereference 
exception to follow isn't such a big deal...)





More information about the wine-users mailing list