get_u32 (zr->fr, &eattr);
get_u32 (zr->fr, &zm->offset);
- zm->name = calloc (nlen + 1, 1);
+ zm->name = xzalloc (nlen + 1);
get_bytes (zr->fr, zm->name, nlen);
skip_bytes (zr->fr, extralen);
off_t offset = 0;
uint32_t central_dir_start, central_dir_length;
- struct zip_reader *zr = malloc (sizeof *zr);
+ struct zip_reader *zr = xzalloc (sizeof *zr);
zr->errs = errs;
if ( zr->errs)
ds_init_empty (zr->errs);
return NULL;
}
- zr->members = calloc (zr->n_members, sizeof (*zr->members));
+ zr->members = xcalloc (zr->n_members, sizeof (*zr->members));
+ memset (zr->members, 0, zr->n_members * sizeof (*zr->members));
zr->filename = strdup (filename);
for (i = 0; i < zr->n_members; ++i)
{
zm = zr->members[i];
+
if (zm == NULL)
zm = zr->members[i] = zip_header_read_next (zr);
if (zm && 0 == strcmp (zm->name, member))
get_u16 (zm->fp, &nlen);
get_u16 (zm->fp, &extra_len);
- name = calloc (nlen + 1, sizeof (char));
+ name = xzalloc (nlen + 1);
get_bytes (zm->fp, name, nlen);