Subtitles: Catch certain memory allocation failures to fix a crash

This is in no way a complete solution, but this seems to fix a
crash with a certain sample on 32bit systems.

Also fixes xy_malloc to not fail within itself in case of allocation
failure.