diff --git a/core_backup.c b/core_backup.c index 4161162d1f..776d2c2b66 100644 --- a/core_backup.c +++ b/core_backup.c @@ -541,18 +541,22 @@ core_backup_list_t *core_backup_list_init( if (!backup_list) goto error; + backup_list->entries = NULL; + backup_list->capacity = 0; + backup_list->size = 0; + /* Create entries array * (Note: Set this to the full size of the directory * list - this may be larger than we need, but saves * many inefficiencies later) */ - entries = (core_backup_list_entry_t*)calloc(dir_list->size, sizeof(*entries)); + entries = (core_backup_list_entry_t*) + calloc(dir_list->size, sizeof(*entries)); if (!entries) goto error; backup_list->entries = entries; backup_list->capacity = dir_list->size; - backup_list->size = 0; /* Loop over backup files and parse file names */ for (i = 0; i < dir_list->size; i++)