diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2019-02-04 18:38:18 +0100 |
---|---|---|
committer | Markus Elfring <elfring@users.sourceforge.net> | 2019-02-04 18:38:18 +0100 |
commit | 429189f00d9deb760cf2c271dc363f4271e0cf73 (patch) | |
tree | 452b7c51aaf48b2a7a308c75fd765de8c8c70c2e /contrib | |
parent | 4bc5892128a042780f167ac35aa72f63c426f3b7 (diff) | |
download | libarchive-429189f00d9deb760cf2c271dc363f4271e0cf73.tar.gz |
Bug #1128: Deletion of unnecessary checks before calls of the function “free”
The function “free” is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
https://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first
This issue was fixed by using the software “Coccinelle 1.0.7”.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/shar/tree.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/shar/tree.c b/contrib/shar/tree.c index d5a04abf..a80d8366 100644 --- a/contrib/shar/tree.c +++ b/contrib/shar/tree.c @@ -530,8 +530,7 @@ tree_close(struct tree *t) /* Release anything remaining in the stack. */ while (t->stack != NULL) tree_pop(t); - if (t->buff) - free(t->buff); + free(t->buff); /* chdir() back to where we started. */ if (t->initialDirFd >= 0) { fchdir(t->initialDirFd); |