]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
close newfs on fopen fail
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 16 Jan 2023 13:20:37 +0000 (14:20 +0100)
committerGitHub <noreply@github.com>
Mon, 16 Jan 2023 13:20:37 +0000 (14:20 +0100)
Co-authored-by: Remi Gacogne <github@coredump.fr>
pdns/recursordist/negcache.cc

index 3097ec0042418ff67125d8bad4e5f95c5bc757e7..cf3b76fe8fb74b7b976724ca33078136ed27bb80 100644 (file)
@@ -274,6 +274,7 @@ size_t NegCache::doDump(int fd, size_t maxCacheEntries)
   }
   auto fp = std::unique_ptr<FILE, int (*)(FILE*)>(fdopen(newfd, "w"), fclose);
   if (!fp) {
+    close(newfd);
     return 0;
   }
   fprintf(fp.get(), "; negcache dump follows\n;\n");