free doesn't return an error whilst GlobalFree does. The Windows heap allocation APIs could now be used but historically GlobalAlloc/GlobalFree were used before know about the Windows heap allocation. They have been used in the DLL that the program link to for many years.