From 11fa3ed9ee1a05aabdba902db9899dfeb664b324 Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Sat, 18 Jul 2009 23:30:33 +0700 Subject: source4/lib/registry/patchfile.c(reg_diff_load): fixed possible resource leak. File descriptor leaks when write(2) fails and we are returning from function. Found by cppcheck: [./source4/lib/registry/patchfile.c:319]: (error) Resource leak: fd --- source4/lib/registry/patchfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index 925806985e..24d86abf48 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -316,6 +316,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename, if (read(fd, &hdr, 4) != 4) { DEBUG(0, ("Error reading registry patch file `%s'\n", filename)); + close(fd); return WERR_GENERAL_FAILURE; } -- cgit