]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix leak in chroot fix for auth-zone.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 28 Nov 2018 12:37:52 +0000 (12:37 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 28 Nov 2018 12:37:52 +0000 (12:37 +0000)
git-svn-id: file:///svn/unbound/trunk@4989 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/authzone.c

index c959aa840fe185e6c69ea8556bc767230171e9db..dee5d58bcf305b8ee670f01730907ceca2cc13d5 100644 (file)
@@ -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
index b58590e401b64ae83c09d45e4aa43cd570c53f30..2b37123a79eeae026c77ca283886dca71333be1a 100644 (file)
@@ -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,