fix: do not overwrite update package list

This commit is contained in:
ngn 2024-08-16 03:08:57 +03:00
parent 7564835b7d
commit a641ef87ed
2 changed files with 10 additions and 2 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-16 01:04+0300\n" "POT-Creation-Date: 2024-08-16 03:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -32,9 +32,15 @@ lm_ctx_update_list_t *lm_ctx_update_list(lm_ctx_t *ctx){
list->entries = malloc(sizeof(lm_entry_t*)*(++list->count)); list->entries = malloc(sizeof(lm_entry_t*)*(++list->count));
else else
list->entries = realloc(list->entries, sizeof(lm_entry_t*)*(++list->count)); list->entries = realloc(list->entries, sizeof(lm_entry_t*)*(++list->count));
list->entries[list->count-1] = cur; list->entries[list->count-1] = cur;
cur = malloc(sizeof(lm_entry_t));
lm_entry_init(cur);
} }
lm_entry_free(cur);
free(cur);
lm_ctx_database_next_free(ctx, NULL); lm_ctx_database_next_free(ctx, NULL);
return list; return list;
} }
@ -63,8 +69,10 @@ void lm_ctx_update_list_free(lm_ctx_update_list_t *list){
} }
if(NULL != list->entries){ if(NULL != list->entries){
for(int i = 0; i < list->count; i++) for(int i = 0; i < list->count; i++){
lm_entry_free(list->entries[i]); lm_entry_free(list->entries[i]);
free(list->entries[i]);
}
free(list->entries); free(list->entries);
} }