Fix error hanldlings in read_irep_record().

read_irep_record_1() and read_irep_record() may return NULL.
Merge pull request #2540 from cubicdaiya/issues/read_irep_record_error_handlings

Fix error hanldlings in read_irep_record().