diff options
author | Ilya Pankratov <90714492+i-pankrat@users.noreply.github.com> | 2024-06-05 20:16:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 17:16:01 +0000 |
commit | 03ea436e1cb35fdcba8fb6588de209d0a10174e9 (patch) | |
tree | 170711d3f7db2c7a6ca92213dc56aa33f26465fb /src/jailcheck/access.c | |
parent | build(deps): bump step-security/harden-runner from 2.7.1 to 2.8.0 (diff) | |
download | firejail-03ea436e1cb35fdcba8fb6588de209d0a10174e9.tar.gz firejail-03ea436e1cb35fdcba8fb6588de209d0a10174e9.tar.zst firejail-03ea436e1cb35fdcba8fb6588de209d0a10174e9.zip |
bugfix: fix various resource leaks (#6367)
Fix memory and descriptor leaks.
Signed-off-by: Ilya Pankratov <i.pankratov.main@gmail.com>
Diffstat (limited to 'src/jailcheck/access.c')
-rw-r--r-- | src/jailcheck/access.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/jailcheck/access.c b/src/jailcheck/access.c index 50c51839b..5fbcb5a15 100644 --- a/src/jailcheck/access.c +++ b/src/jailcheck/access.c | |||
@@ -80,10 +80,13 @@ void access_setup(const char *directory) { | |||
80 | FILE *fp = fopen(test_file, "w"); | 80 | FILE *fp = fopen(test_file, "w"); |
81 | if (!fp) { | 81 | if (!fp) { |
82 | printf("Warning: I cannot create test file in directory %s, skipping...\n", directory); | 82 | printf("Warning: I cannot create test file in directory %s, skipping...\n", directory); |
83 | free(test_file); | ||
84 | free(path); | ||
83 | return; | 85 | return; |
84 | } | 86 | } |
85 | fprintf(fp, "this file was created by firetest utility, you can safely delete it\n"); | 87 | fprintf(fp, "this file was created by firetest utility, you can safely delete it\n"); |
86 | fclose(fp); | 88 | fclose(fp); |
89 | free(path); | ||
87 | int rv = chown(test_file, user_uid, user_gid); | 90 | int rv = chown(test_file, user_uid, user_gid); |
88 | if (rv) | 91 | if (rv) |
89 | errExit("chown"); | 92 | errExit("chown"); |