From a5a8e00b6d0939527eb764745eef6f86d187cc6a Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 28 Oct 2020 18:51:57 -0400 Subject: Fix a crash introduced in a605cdf70 Pretty subtle problem; looks like the skin core was relying on a destructor to actually help initialize things. Change-Id: Ieb4b9e4f11377dec7be61d13759590fc5f4bc921 --- apps/gui/skin_engine/skin_parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apps/gui/skin_engine') diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 8e59c2c2b0..789d42aab5 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1715,7 +1715,7 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data) if (wps_data->wps_loaded) skin_buffer = get_skin_buffer(wps_data); if (!skin_buffer) - return; + goto abort; #ifndef __PCTOOL__ struct skin_token_list *list = SKINOFFSETTOPTR(skin_buffer, wps_data->images); @@ -1744,13 +1744,15 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data) } list = SKINOFFSETTOPTR(skin_buffer, list->next); } - wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); if (font_ids != NULL) { while (wps_data->font_count > 0) font_unload(font_ids[--wps_data->font_count]); } - wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); + +abort: + wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */ + wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); if (wps_data->buflib_handle > 0) core_free(wps_data->buflib_handle); wps_data->buflib_handle = -1; -- cgit v1.2.3