Use calloc().

MFC after:	2 weeks
This commit is contained in:
Xin LI 2013-06-05 21:56:29 +00:00
parent ac8e13960d
commit c84739b210
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251440

View File

@ -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);