use calloc instead of malloc + memset
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2497 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
edb11bd2ea
commit
7ff54c7e2e
|
@ -344,11 +344,10 @@ void sc_file_clear_acl_entries(sc_file_t *file, unsigned int operation)
|
|||
|
||||
sc_file_t * sc_file_new()
|
||||
{
|
||||
sc_file_t *file = (sc_file_t *) malloc(sizeof(sc_file_t));
|
||||
|
||||
sc_file_t *file = (sc_file_t *)calloc(1, sizeof(sc_file_t));
|
||||
if (file == NULL)
|
||||
return NULL;
|
||||
memset(file, 0, sizeof(sc_file_t));
|
||||
|
||||
file->magic = SC_FILE_MAGIC;
|
||||
return file;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue