diff options
author | smitsohu <smitsohu@gmail.com> | 2018-10-13 21:47:17 +0200 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2018-10-13 21:47:17 +0200 |
commit | 89f6dcf845cb433960f2159610c447d6977776b9 (patch) | |
tree | c91612555f1a03bfd30b79546427c32fe8d3ee49 | |
parent | fs_whitelist: no warning if macro resolution fails because of missing homedir (diff) | |
download | firejail-89f6dcf845cb433960f2159610c447d6977776b9.tar.gz firejail-89f6dcf845cb433960f2159610c447d6977776b9.tar.zst firejail-89f6dcf845cb433960f2159610c447d6977776b9.zip |
improve clean_pathname() function: drop realloc
rf. previous commit a5b7a9a8bec6a7f2162850449b1ff29c1fde2826
freeing what is expected to be a single byte only is most probably not
worth the effort
-rw-r--r-- | src/firejail/util.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/firejail/util.c b/src/firejail/util.c index 0d1418b43..61330a87e 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -560,13 +560,6 @@ char *clean_pathname(const char *path) { | |||
560 | // remove a trailing slash | 560 | // remove a trailing slash |
561 | if (j > 1 && rv[j - 1] == '/') | 561 | if (j > 1 && rv[j - 1] == '/') |
562 | rv[j - 1] = '\0'; | 562 | rv[j - 1] = '\0'; |
563 | |||
564 | size_t new_len = strlen(rv); | ||
565 | if (new_len < len) { | ||
566 | rv = realloc(rv, new_len + 1); | ||
567 | if (!rv) | ||
568 | errExit("realloc"); | ||
569 | } | ||
570 | } | 563 | } |
571 | 564 | ||
572 | return rv; | 565 | return rv; |