From e5bc3965230c2584ac52b4cbed8b06522838aa46 Mon Sep 17 00:00:00 2001 From: Philip Paeps Date: Mon, 25 Apr 2016 11:55:17 +0530 Subject: [PATCH] higher.c: don't try to free unallocated memory 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. --- higher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/higher.c b/higher.c index e3077aee..528283ce 100644 --- a/higher.c +++ b/higher.c @@ -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);