summaryrefslogtreecommitdiff
path: root/source4/lib/registry/patchfile.c
diff options
context:
space:
mode:
authorSlava Semushin <php-coder@altlinux.ru>2009-07-18 23:30:33 +0700
committerJelmer Vernooij <jelmer@samba.org>2009-07-19 16:01:12 +0200
commit11fa3ed9ee1a05aabdba902db9899dfeb664b324 (patch)
tree4afc639c565ca491e652b5d861aa9a393ba21535 /source4/lib/registry/patchfile.c
parent5f8df164716a43bd9e6c22dfd1f066bf96ccf273 (diff)
downloadsamba-11fa3ed9ee1a05aabdba902db9899dfeb664b324.tar.gz
samba-11fa3ed9ee1a05aabdba902db9899dfeb664b324.tar.bz2
samba-11fa3ed9ee1a05aabdba902db9899dfeb664b324.zip
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
Diffstat (limited to 'source4/lib/registry/patchfile.c')
-rw-r--r--source4/lib/registry/patchfile.c1
1 files changed, 1 insertions, 0 deletions
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;
}