From: Wouter Wijngaards Date: Wed, 28 Nov 2018 12:37:52 +0000 (+0000) Subject: - Fix leak in chroot fix for auth-zone. X-Git-Tag: release-1.8.2rc1~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3330d5296c629426671d007bb585b2cc5b4336e9;p=thirdparty%2Funbound.git - Fix leak in chroot fix for auth-zone. git-svn-id: file:///svn/unbound/trunk@4989 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index c959aa840..dee5d58bc 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +28 November 2018: Wouter + - Fix leak in chroot fix for auth-zone. + 27 November 2018: Wouter - Fix DNS64 to not store intermediate results in cache, this avoids other threads from picking up the wrong data. The module restores diff --git a/services/authzone.c b/services/authzone.c index b58590e40..2b37123a7 100644 --- a/services/authzone.c +++ b/services/authzone.c @@ -1484,7 +1484,6 @@ az_parse_file(struct auth_zone* z, FILE* in, uint8_t* rr, size_t rrbuflen, incfile++; /* adjust for chroot on include file */ incfile = fname_after_chroot(incfile, cfg, 1); - incfile = strdup(incfile); if(!incfile) { log_err("malloc failure"); return 0; @@ -1564,11 +1563,13 @@ auth_zone_read_zonefile(struct auth_zone* z, struct config_file* cfg) verbose(VERB_ALGO, "no zonefile %s for %s", zfilename, n?n:"error"); free(n); + free(zfilename); return 1; } log_err("cannot open zonefile %s for %s: %s", zfilename, n?n:"error", strerror(errno)); free(n); + free(zfilename); return 0; } @@ -1590,9 +1591,11 @@ auth_zone_read_zonefile(struct auth_zone* z, struct config_file* cfg) log_err("error parsing zonefile %s for %s", zfilename, n?n:"error"); free(n); + free(zfilename); fclose(in); return 0; } + free(zfilename); fclose(in); return 1; } @@ -4829,6 +4832,7 @@ xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env) verbose(VERB_ALGO, "tmpfilename too long, cannot update " " zonefile %s", zfilename); lock_rw_unlock(&z->lock); + free(zfilename); return; } snprintf(tmpfile, sizeof(tmpfile), "%s.tmp%u", zfilename, @@ -4842,6 +4846,7 @@ xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env) } else if(!auth_zone_write_file(z, tmpfile)) { unlink(tmpfile); lock_rw_unlock(&z->lock); + free(zfilename); return; } if(rename(tmpfile, zfilename) < 0) { @@ -4849,9 +4854,11 @@ xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env) strerror(errno)); unlink(tmpfile); lock_rw_unlock(&z->lock); + free(zfilename); return; } lock_rw_unlock(&z->lock); + free(zfilename); } /** process chunk list and update zone in memory,