Fixed missing malloc check.