Avoid calling memcpy with a negative length in an error case.

Fixes Coverity 1047250.