Skip to content

Commit

Permalink
Merge pull request #5427 from craigcomstock/CFE-4310/master
Browse files Browse the repository at this point in the history
  • Loading branch information
larsewi authored Jan 16, 2024
2 parents 6f59bf0 + 846237c commit 1809094
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cf-agent/verify_users_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ static bool ChangePasswordHashUsingLckpwdf(const char *puser, const char *passwo
}

fclose(edit_fd);
edit_fd = NULL; // mark as NULL so we don't close it later
fclose(passwd_fd);
passwd_fd = NULL; // mark as NULL so we don't close it later

if (!CopyFilePermissionsDisk(passwd_file, edit_file))
{
Expand All @@ -613,10 +615,16 @@ static bool ChangePasswordHashUsingLckpwdf(const char *puser, const char *passwo
goto unlock_passwd;

close_both:
fclose(edit_fd);
if (edit_fd != NULL)
{
fclose(edit_fd);
}
unlink(edit_file);
close_passwd_fd:
fclose(passwd_fd);
if (passwd_fd != NULL)
{
fclose(passwd_fd);
}
unlock_passwd:
ulckpwdf();

Expand Down
1 change: 1 addition & 0 deletions cf-check/diagnose.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ static int diagnose(const char *path, bool temporary_redirect, bool validate)
return errno;
}
assert(f_result == stdout);
fclose(f_result);
ret = lmdump(LMDUMP_VALUES_ASCII, path);
}
return lmdb_errno_to_cf_check_code(ret);
Expand Down
2 changes: 2 additions & 0 deletions tests/static-check/run_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ function check_with_cppcheck() {
# cppcheck options:
# -I -- include paths
# -i -- ignored files/folders
# --include=<file> -- force including a file, e.g. config.h
# Identified issues are printed to stderr
cppcheck --quiet -j${n_procs} --error-exitcode=1 ./ \
--suppressions-list=tests/static-check/cppcheck_suppressions.txt \
--include=config.h \
-I cf-serverd/ -I libpromises/ -I libcfnet/ -I libntech/libutils/ \
-i 3rdparty -i .github/codeql -i libntech/.lgtm -i tests -i libpromises/cf3lex.c \
2>&1 1>/dev/null
Expand Down

0 comments on commit 1809094

Please sign in to comment.