Remove errno usage after malloc() calls

Standard malloc() doesn't set errno on failure, so use plain ENOMEM instead.