summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_set_format_shar.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2016-12-06 15:58:03 +0100
committerJoerg Sonnenberger <joerg@bec.de>2016-12-06 15:58:03 +0100
commit72abdbb8ba51e926432de242f4df5cf632546dc9 (patch)
tree95764c8621b49dcf02215011b69d28f301478cdd /libarchive/archive_write_set_format_shar.c
parentd4d4f91251a084d036518afb8423350c48914bf1 (diff)
downloadlibarchive-72abdbb8ba51e926432de242f4df5cf632546dc9.tar.gz
Replace malloc + memset with calloc.
Diffstat (limited to 'libarchive/archive_write_set_format_shar.c')
-rw-r--r--libarchive/archive_write_set_format_shar.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libarchive/archive_write_set_format_shar.c b/libarchive/archive_write_set_format_shar.c
index c033fb32..5be310a0 100644
--- a/libarchive/archive_write_set_format_shar.c
+++ b/libarchive/archive_write_set_format_shar.c
@@ -113,12 +113,11 @@ archive_write_set_format_shar(struct archive *_a)
if (a->format_free != NULL)
(a->format_free)(a);
- shar = (struct shar *)malloc(sizeof(*shar));
+ shar = (struct shar *)calloc(1, sizeof(*shar));
if (shar == NULL) {
archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data");
return (ARCHIVE_FATAL);
}
- memset(shar, 0, sizeof(*shar));
archive_string_init(&shar->work);
archive_string_init(&shar->quoted_name);
a->format_data = shar;