Handle the error if malloc is failed in load_with_gd