Use calloc().
MFC after: 2 weeks
This commit is contained in:
parent
c07c28ee99
commit
d8a3474063
@ -343,7 +343,7 @@ ef_obj_open(const char *filename, struct elf_file *efile, int verbose)
|
||||
if ((fd = open(filename, O_RDONLY)) == -1)
|
||||
return errno;
|
||||
|
||||
ef = malloc(sizeof(*ef));
|
||||
ef = calloc(1, sizeof(*ef));
|
||||
if (ef == NULL) {
|
||||
close(fd);
|
||||
return (ENOMEM);
|
||||
@ -352,7 +352,6 @@ ef_obj_open(const char *filename, struct elf_file *efile, int verbose)
|
||||
efile->ef_ef = ef;
|
||||
efile->ef_ops = &ef_obj_file_ops;
|
||||
|
||||
bzero(ef, sizeof(*ef));
|
||||
ef->ef_verbose = verbose;
|
||||
ef->ef_fd = fd;
|
||||
ef->ef_name = strdup(filename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user