Skip to content

Commit

Permalink
dsdb: Improve code and directly close fp
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Volker Lendecke <[email protected]>
  • Loading branch information
cryptomilk authored and vlendec committed Dec 20, 2017
1 parent 287236e commit 23a62c9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions source4/dsdb/samdb/ldb_modules/encrypted_secrets.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ static int load_keys(struct ldb_module *module, struct es_data *data)
}

read = fread(key.data, 1, key.length, fp);
fclose(fp);
if (read == 0) {
TALLOC_FREE(frame);
fclose(fp);
ldb_debug(ldb,
LDB_DEBUG_WARNING,
"Zero length encrypted secrets key file. "
Expand All @@ -325,7 +325,6 @@ static int load_keys(struct ldb_module *module, struct es_data *data)
}
if (read != key.length) {
TALLOC_FREE(frame);
fclose(fp);
if (errno) {
log_error(ldb,
errno,
Expand All @@ -340,8 +339,6 @@ static int load_keys(struct ldb_module *module, struct es_data *data)
}
return LDB_ERR_OPERATIONS_ERROR;
}
fclose(fp);


data->keys[0] = key;
data->encrypt_secrets = true;
Expand Down

0 comments on commit 23a62c9

Please sign in to comment.