added malloc return vlaue check for intrev