Fix error hanldlings in read_irep_record().

read_irep_record_1() and read_irep_record() may return NULL.