aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2020-09-28 10:25:48 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2020-09-28 10:25:48 -0400
commit823dd6b285d171615eb5f1ff7701e73a5758d390 (patch)
treebd37335917ff6493ff5f3abbcd63a84629dccc1f /src
parentfree some memory; get rid of false positive from gcc static analyzer (diff)
downloadfirejail-823dd6b285d171615eb5f1ff7701e73a5758d390.tar.gz
firejail-823dd6b285d171615eb5f1ff7701e73a5758d390.tar.zst
firejail-823dd6b285d171615eb5f1ff7701e73a5758d390.zip
clean gcc ananlyzer warnings - #3377
Diffstat (limited to 'src')
-rw-r--r--src/firejail/paths.c1
-rw-r--r--src/firejail/sbox.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/firejail/paths.c b/src/firejail/paths.c
index f03d98e29..5de704bef 100644
--- a/src/firejail/paths.c
+++ b/src/firejail/paths.c
@@ -45,6 +45,7 @@ static void init_paths(void) {
45 paths = calloc(path_cnt, sizeof(char *)); 45 paths = calloc(path_cnt, sizeof(char *));
46 if (!paths) 46 if (!paths)
47 errExit("calloc"); 47 errExit("calloc");
48 memset(paths, 0, path_cnt * sizeof(char *)); // get rid of false positive error from GCC static analyzer
48 49
49 // fill in 'paths' with pointers to elements of 'path' 50 // fill in 'paths' with pointers to elements of 'path'
50 unsigned int i = 0, j; 51 unsigned int i = 0, j;
diff --git a/src/firejail/sbox.c b/src/firejail/sbox.c
index a92d62940..a2aaa86eb 100644
--- a/src/firejail/sbox.c
+++ b/src/firejail/sbox.c
@@ -263,6 +263,7 @@ int sbox_run(unsigned filtermask, int num, ...) {
263 263
264int sbox_run_v(unsigned filtermask, char * const arg[]) { 264int sbox_run_v(unsigned filtermask, char * const arg[]) {
265 EUID_ROOT(); 265 EUID_ROOT();
266 assert(arg);
266 267
267 if (arg_debug) { 268 if (arg_debug) {
268 printf("sbox run: "); 269 printf("sbox run: ");
@@ -288,7 +289,7 @@ int sbox_run_v(unsigned filtermask, char * const arg[]) {
288 if (waitpid(child, &status, 0) == -1 ) { 289 if (waitpid(child, &status, 0) == -1 ) {
289 errExit("waitpid"); 290 errExit("waitpid");
290 } 291 }
291 if (WIFEXITED(status) && status != 0) { 292 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
292 fprintf(stderr, "Error: failed to run %s\n", arg[0]); 293 fprintf(stderr, "Error: failed to run %s\n", arg[0]);
293 exit(1); 294 exit(1);
294 } 295 }