From f4d1e8c1e2920560c9db49cd3511f0edbd577c8b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 20 Feb 2013 10:10:15 +0100 Subject: [PATCH] s4-registry: Don't leak file descriptor. Reviewed-by: Alexander Bokovoy --- source4/lib/registry/hive.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index dc38fc82152f..d79135fadba9 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); } -- 2.34.1