@@ -407,7 +407,6 @@ static void remove_sw_file(char __attribute__ ((__unused__)) *fname)
void cleanup_files(struct swupdate_cfg *software) {
char fn[64];
struct img_type *img;
- struct dict_entry *bootvar;
struct hw_type *hw;
const char* TMPDIR = get_tmpdir();
@@ -433,9 +432,9 @@ void cleanup_files(struct swupdate_cfg *software) {
LIST_REMOVE(img, next);
free(img);
}
- LIST_FOREACH(bootvar, &software->bootloader, next) {
- dict_remove_entry(bootvar);
- }
+
+ dict_drop_db(&software->bootloader);
+
snprintf(fn, sizeof(fn), "%s%s", TMPDIR, BOOT_SCRIPT_SUFFIX);
remove_sw_file(fn);
@@ -103,3 +103,12 @@ void dict_remove(struct dictlist *dictionary, char *key)
dict_remove_entry(entry);
}
+
+void dict_drop_db(struct dictlist *dictionary)
+{
+ struct dict_entry *var;
+
+ LIST_FOREACH(var, dictionary, next) {
+ dict_remove_entry(var);
+ }
+}
@@ -36,5 +36,6 @@ int dict_set_value(struct dictlist *dictionary, char *key, char *value);
int dict_insert_entry(struct dictlist *dictionary, char *key, char *value);
void dict_remove(struct dictlist *dictionary, char *key);
void dict_remove_entry(struct dict_entry *entry);
+void dict_drop_db(struct dictlist *dictionary);
#endif
Add fucntion dict_drop_db() and call it from installer. Signed-off-by: Stefano Babic <sbabic@denx.de> --- corelib/installer.c | 7 +++---- corelib/swupdate_dict.c | 9 +++++++++ include/swupdate_dict.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-)