~bitfehler/hdig

47c8d788aa8a0d427b297832596b84c6ec33b390 — Conrad Hoffmann 5 months ago ef7b042
Be diligent (again) about freeing memory...
1 files changed, 23 insertions(+), 7 deletions(-)

M main.ha
M main.ha => main.ha +23 -7
@@ 21,19 21,35 @@ fn print_rr(rr: dns::rrecord) void = {
	case let d: dns::caa =>
		fmt::printfln(" CAA {} {}={}", d.flags, d.tag, d.value)!;
	case let d: dns::cname =>
		fmt::printfln(" CNAME {}", dns::unparse_domain(d.name))!;
		let dom = dns::unparse_domain(d.name);
		defer free(dom);
		fmt::printfln(" CNAME {}", dom)!;
	case let d: dns::mx =>
		fmt::printfln(" MX {} {}", d.priority, dns::unparse_domain(d.name))!;
		let dom = dns::unparse_domain(d.name);
		defer free(dom);
		fmt::printfln(" MX {} {}", d.priority, dom)!;
	case let d: dns::ns =>
		fmt::printfln(" NS {}", dns::unparse_domain(d.name))!;
		let dom = dns::unparse_domain(d.name);
		defer free(dom);
		fmt::printfln(" NS {}", dom)!;
	case let d: dns::ptr =>
		fmt::printfln(" PTR {}", dns::unparse_domain(d.name))!;
		let dom = dns::unparse_domain(d.name);
		defer free(dom);
		fmt::printfln(" PTR {}", dom)!;
	case let d: dns::soa =>
		fmt::printfln(" SOA {} {} {} {} {} {}", dns::unparse_domain(d.mname), dns::unparse_domain(d.rname), d.serial, d.refresh, d.retry, d.expire)!;
		let mname = dns::unparse_domain(d.mname);
		defer free(mname);
		let rname = dns::unparse_domain(d.rname);
		defer free(rname);
		fmt::printfln(" SOA {} {} {} {} {} {}", mname, rname, d.serial, d.refresh, d.retry, d.expire)!;
	case let d: dns::srv =>
		fmt::printfln(" SRV {} {} {} {}", d.priority, d.weight, d.port, dns::unparse_domain(d.target))!;
		let dom = dns::unparse_domain(d.target);
		defer free(dom);
		fmt::printfln(" SRV {} {} {} {}", d.priority, d.weight, d.port, dom)!;
	case let d: dns::sshfp =>
		fmt::printfln(" SSHFP {} {} {}", d.algorithm, d.fp_type, hex::encodestr(d.fingerprint))!;
		let fp = hex::encodestr(d.fingerprint);
		defer free(fp);
		fmt::printfln(" SSHFP {} {} {}", d.algorithm, d.fp_type, fp)!;
	case let d: dns::txt =>
		fmt::printf(" TXT")!;
		for (let j = 0z; j < len(d); j += 1) {