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 /test_utils | |
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 'test_utils')
-rw-r--r-- | test_utils/test_main.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test_utils/test_main.c b/test_utils/test_main.c index bb71217b..defdd344 100644 --- a/test_utils/test_main.c +++ b/test_utils/test_main.c @@ -2590,10 +2590,8 @@ sunacl_get(int cmd, int *aclcnt, int fd, const char *path) cnt = facl(fd, cmd, cnt, aclp); } } else { - if (aclp != NULL) { - free(aclp); - aclp = NULL; - } + free(aclp); + aclp = NULL; break; } } |