Check for valid malloc