Index: finalizer.c =================================================================== --- finalizer.c (revision 1720) +++ finalizer.c (working copy) @@ -71,8 +71,7 @@ FILE *input_file = stdin; char line[MAX_LINE_LEN]; int line_len = 0; - char *pre_soa_lines[MAX_LINE_LEN]; - size_t pre_count = 0, i; + size_t pre_count = 0, soa_line=0, line_count=0; ldns_rr *rr; while ((c = getopt(argc, argv, "f:h")) != -1) { @@ -98,25 +97,29 @@ (void) ldns_rr_new_frm_str(&rr, line, 0, NULL, NULL); if (rr && ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { printf("%s\n", line); + soa_line = pre_count; break; } } - pre_soa_lines[pre_count++] = strdup(line); + pre_count++; } } - /* do the skipped lines */ - for (i = 0; i < pre_count; i++) { - handle_line(pre_soa_lines[i]); - free(pre_soa_lines[i]); - } + /* Goes to the beginning of the file and print the rest of the + * records + */ - /* and finish off the rest */ + rewind(input_file); + line_count = 0; + while (line_len >= 0) { line_len = read_line(input_file, line, 0); + if (soa_line == line_count) + continue; if (line_len > 0) { handle_line(line); } + line_count++; } if (input_file != stdin) {