Fix broken memory leak check in legacy API

This was a check for the realloc() call, but the result was never
used in the success case - which makes no sense.

Doesn't really matter, because it's the legacy charset code which
hopefully is not used by anyone.

Found by Coverity.