Testing code for malloc error

Updating code for the one that compiled with g++