From c39b79656b48004100395bdf45c7b73fcf8dc4cc Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Sat, 18 Jul 2009 23:30:33 +0700 Subject: [PATCH] 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 files changed, 1 insertions(+), 0 deletions(-) diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index 9258069..24d86ab 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; } -- 1.6.3.3