Skip to content

Commit

Permalink
higher.c: don't try to free unallocated memory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ppaeps authored and wtoorop committed Apr 26, 2016
1 parent 2d4d5b1 commit e5bc396
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion higher.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr)
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);
Expand Down

0 comments on commit e5bc396

Please sign in to comment.