summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-20 10:10:15 +0100
committerAlexander Bokovoy <ab@samba.org>2013-02-22 16:36:14 +0100
commitf4d1e8c1e2920560c9db49cd3511f0edbd577c8b (patch)
treeb6fa7a5bfd0d6a8028308c908078e3a19c6a8e78 /source4/lib
parent66ee744ccbb0a57e651d76881328554dffab8bcd (diff)
downloadsamba-f4d1e8c1e2920560c9db49cd3511f0edbd577c8b.tar.gz
samba-f4d1e8c1e2920560c9db49cd3511f0edbd577c8b.tar.bz2
samba-f4d1e8c1e2920560c9db49cd3511f0edbd577c8b.zip
s4-registry: Don't leak file descriptor.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/registry/hive.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index dc38fc8215..d79135fadb 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -43,15 +43,14 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
}
num = read(fd, peek, 20);
+ close(fd);
if (num == -1) {
return WERR_BADFILE;
}
if (!strncmp(peek, "regf", 4)) {
- close(fd);
return reg_open_regf_file(parent_ctx, location, root);
} else if (!strncmp(peek, "TDB file", 8)) {
- close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,
credentials, ev_ctx, lp_ctx, root);
}