From 4c86e67c6e969cb7f330dd6ae0e58ea3059170e0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Jun 2020 19:18:43 +0200 Subject: [PATCH] core_backup_list_init - prevent garbage values --- core_backup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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++)