summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_set_format_v7tar.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2019-02-04 19:00:32 +0100
committerMarkus Elfring <elfring@users.sourceforge.net>2019-02-04 19:00:32 +0100
commit4736e4e715fa929b27958b84c9292faf58517eac (patch)
tree8a242ca5f9d476ec5e80c3d3ea0fd86f59ee7d12 /libarchive/archive_write_set_format_v7tar.c
parent429189f00d9deb760cf2c271dc363f4271e0cf73 (diff)
downloadlibarchive-4736e4e715fa929b27958b84c9292faf58517eac.tar.gz
Bug #1128: Deletion of unnecessary checks before calls of the function “archive_entry_free”
The function “archive_entry_free” is implemented in the way that only two functions are called which tolerate the passing of null pointers. It is therefore not needed that a function caller repeats a corresponding check. This issue was fixed by using the software “Coccinelle 1.0.7”. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Diffstat (limited to 'libarchive/archive_write_set_format_v7tar.c')
-rw-r--r--libarchive/archive_write_set_format_v7tar.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libarchive/archive_write_set_format_v7tar.c b/libarchive/archive_write_set_format_v7tar.c
index 53c0db0e..1fdaafd2 100644
--- a/libarchive/archive_write_set_format_v7tar.c
+++ b/libarchive/archive_write_set_format_v7tar.c
@@ -330,14 +330,12 @@ archive_write_v7tar_header(struct archive_write *a, struct archive_entry *entry)
#endif
ret = format_header_v7tar(a, buff, entry, 1, sconv);
if (ret < ARCHIVE_WARN) {
- if (entry_main)
- archive_entry_free(entry_main);
+ archive_entry_free(entry_main);
return (ret);
}
ret2 = __archive_write_output(a, buff, 512);
if (ret2 < ARCHIVE_WARN) {
- if (entry_main)
- archive_entry_free(entry_main);
+ archive_entry_free(entry_main);
return (ret2);
}
if (ret2 < ret)
@@ -345,8 +343,7 @@ archive_write_v7tar_header(struct archive_write *a, struct archive_entry *entry)
v7tar->entry_bytes_remaining = archive_entry_size(entry);
v7tar->entry_padding = 0x1ff & (-(int64_t)v7tar->entry_bytes_remaining);
- if (entry_main)
- archive_entry_free(entry_main);
+ archive_entry_free(entry_main);
return (ret);
}