aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2018-08-22 12:17:39 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2018-08-22 12:17:39 +0200
commit1da58e654155369b5bdd5ae1c7b33d0cc4c804b7 (patch)
tree2f9ea21b141ddf6841e40c4b3b4dc6f9dd85f035
parentdrop privs when permissions are changed in /run/user/$UID (diff)
downloadfirejail-1da58e654155369b5bdd5ae1c7b33d0cc4c804b7.tar.gz
firejail-1da58e654155369b5bdd5ae1c7b33d0cc4c804b7.tar.zst
firejail-1da58e654155369b5bdd5ae1c7b33d0cc4c804b7.zip
close private-cache memleak
-rw-r--r--src/firejail/fs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/firejail/fs.c b/src/firejail/fs.c
index 8db14d502..7b138eada 100644
--- a/src/firejail/fs.c
+++ b/src/firejail/fs.c
@@ -1382,14 +1382,17 @@ void fs_private_cache(void) {
1382 struct stat s; 1382 struct stat s;
1383 if (is_link(cache)) { 1383 if (is_link(cache)) {
1384 fwarning("user .cache is a symbolic link, tmpfs not mounted\n"); 1384 fwarning("user .cache is a symbolic link, tmpfs not mounted\n");
1385 free(cache);
1385 return; 1386 return;
1386 } 1387 }
1387 if (stat(cache, &s) == -1 || !S_ISDIR(s.st_mode)) { 1388 if (stat(cache, &s) == -1 || !S_ISDIR(s.st_mode)) {
1388 fwarning("no user .cache directory found, tmpfs not mounted\n"); 1389 fwarning("no user .cache directory found, tmpfs not mounted\n");
1390 free(cache);
1389 return; 1391 return;
1390 } 1392 }
1391 if (s.st_uid != getuid()) { 1393 if (s.st_uid != getuid()) {
1392 fwarning("user .cache is not owned by current user, tmpfs not mounted\n"); 1394 fwarning("user .cache is not owned by current user, tmpfs not mounted\n");
1395 free(cache);
1393 return; 1396 return;
1394 } 1397 }
1395 1398