summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-10-15 09:08:09 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2022-10-15 09:26:58 -0400
commit12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69 (patch)
treeb4885951a5cba1b78c21b30ce37a1d6f1574aa5f /apps/gui
parent9d3d925295112a0080bc1d70fad170db9e1af2a9 (diff)
downloadrockbox-12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69.tar.gz
rockbox-12ef045fdf5a9e2b4d5618cc3b7ba50ecc0ccf69.zip
move buflib_free invalid handle check to the function
allow buflib_free to check for invalid or already freed handles within the function -- remove all the invalid handle guards thru core_free Change-Id: Ibdcbc82760fc93b674c42283fca420d94907df8e
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c3
-rw-r--r--apps/gui/skin_engine/skin_parser.c4
2 files changed, 2 insertions, 5 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 146dccb18a..1def0812da 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -267,8 +267,7 @@ void skin_backdrop_unload(int backdrop_id)
267 backdrops[backdrop_id].ref_count--; 267 backdrops[backdrop_id].ref_count--;
268 if (backdrops[backdrop_id].ref_count <= 0) 268 if (backdrops[backdrop_id].ref_count <= 0)
269 { 269 {
270 if (backdrops[backdrop_id].buflib_handle > 0) 270 core_free(backdrops[backdrop_id].buflib_handle);
271 core_free(backdrops[backdrop_id].buflib_handle);
272 backdrops[backdrop_id].buffer = NULL; 271 backdrops[backdrop_id].buffer = NULL;
273 backdrops[backdrop_id].buflib_handle = -1; 272 backdrops[backdrop_id].buflib_handle = -1;
274 backdrops[backdrop_id].loaded = false; 273 backdrops[backdrop_id].loaded = false;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 6021f0647c..26a251bb4b 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1829,9 +1829,7 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data)
1829abort: 1829abort:
1830 wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */ 1830 wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */
1831 wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); 1831 wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL);
1832 if (wps_data->buflib_handle > 0) 1832 wps_data->buflib_handle = core_free(wps_data->buflib_handle);
1833 core_free(wps_data->buflib_handle);
1834 wps_data->buflib_handle = -1;
1835#endif 1833#endif
1836} 1834}
1837 1835