Skip to content

Commit

Permalink
free some memory; get rid of false positive from gcc static analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Sep 28, 2020
1 parent 21337a0 commit c6166d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/firejail/ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static void print_file_or_dir(const char *path, const char *fname) {
return;
}
}
free(name);

// permissions
if (S_ISLNK(s.st_mode))
Expand Down Expand Up @@ -171,10 +172,11 @@ static void print_directory(const char *path) {
if (n < 0)
errExit("scandir");
else {
for (i = 0; i < n; i++) {
for (i = 0; i < n; i++)
print_file_or_dir(path, namelist[i]->d_name);
// get rid of false psitive reported by GCC -fanalyze
for (i = 0; i < n; i++)
free(namelist[i]);
}
}
free(namelist);
}
Expand Down

0 comments on commit c6166d7

Please sign in to comment.