fixed compile errors on Linux due to malloc, __declspec on gcc