aboutsummaryrefslogtreecommitdiff
path: root/libpamc/test/modules
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2024-01-04 17:46:38 +0100
committerChristian Göttsche <cgzones@googlemail.com>2024-01-04 17:46:38 +0100
commitb1e446f59e50c03d88015b6cb078fb65bec7d77e (patch)
tree365ddb122b727ae60444f0283f563160498d92d2 /libpamc/test/modules
parent9893308eb4be8baadf94c347eaf04610018d9223 (diff)
downloadpam-b1e446f59e50c03d88015b6cb078fb65bec7d77e.tar.gz
pam-b1e446f59e50c03d88015b6cb078fb65bec7d77e.tar.bz2
pam-b1e446f59e50c03d88015b6cb078fb65bec7d77e.zip
libpamc/test: pipe deallocation mismatch
Close pipes opened via popen(3) with pclose(3). Also close the pipe in error branches. Reported by cppcheck.
Diffstat (limited to 'libpamc/test/modules')
-rw-r--r--libpamc/test/modules/pam_secret.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpamc/test/modules/pam_secret.c b/libpamc/test/modules/pam_secret.c
index 2fe7066c..12215359 100644
--- a/libpamc/test/modules/pam_secret.c
+++ b/libpamc/test/modules/pam_secret.c
@@ -123,15 +123,17 @@ int create_digest(const char *d1, const char *d2, const char *d3,
if (fgets(buffer_33, 33, pipe) == NULL) {
D(("failed to read digest"));
+ pclose(pipe);
return 0;
}
if (strlen(buffer_33) != 32) {
D(("digest was not 32 chars"));
+ pclose(pipe);
return 0;
}
- fclose(pipe);
+ pclose(pipe);
D(("done [%s]", buffer_33));