Gui: fix memory leak in file browser module (#1848)

This commit is contained in:
あく 2022-10-08 19:57:53 +09:00 committed by GitHub
parent 88ca267466
commit c13929330e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,6 @@ static void BrowserItem_t_set(BrowserItem_t* obj, const BrowserItem_t* src) {
furi_string_set(obj->path, src->path); furi_string_set(obj->path, src->path);
furi_string_set(obj->display_name, src->display_name); furi_string_set(obj->display_name, src->display_name);
if(src->custom_icon_data) { if(src->custom_icon_data) {
obj->custom_icon_data = malloc(CUSTOM_ICON_MAX_SIZE);
memcpy(obj->custom_icon_data, src->custom_icon_data, CUSTOM_ICON_MAX_SIZE); memcpy(obj->custom_icon_data, src->custom_icon_data, CUSTOM_ICON_MAX_SIZE);
} else { } else {
obj->custom_icon_data = NULL; obj->custom_icon_data = NULL;
@ -379,6 +378,9 @@ static void
}); });
furi_string_free(item.display_name); furi_string_free(item.display_name);
furi_string_free(item.path); furi_string_free(item.path);
if(item.custom_icon_data) {
free(item.custom_icon_data);
}
} else { } else {
with_view_model( with_view_model(
browser->view, (FileBrowserModel * model) { browser->view, (FileBrowserModel * model) {