Fixed a crash with GCC libs caused by calling FreeHGlobal on non-AllocHGlobal memory.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>