ldns_rr_new_frm_str() will only return an allocated rr if if can
successfully parse the string. Don't try to free rr unless this is the
case. Some malloc implementations (e.g. Mac OS X) crash when trying to
free unallocated memory.
parse_result = ldns_rr_new_frm_str(&rr, rr_str, 0, NULL, NULL);
if (parse_result == LDNS_STATUS_OK && ldns_rr_owner(rr) && ldns_rr_rd_count(rr) > 0) {
ldns_rr_list_push_rr(list, ldns_rr_clone(rr));
+ ldns_rr_free(rr);
}
- ldns_rr_free(rr);
}
}
ldns_buffer_free(linebuf);