diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-03-04 09:16:13 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2021-03-04 14:25:58 +0000 |
commit | a4a5f5f33fd79ed625c280ac779f41d547846fe8 (patch) | |
tree | 2087bb4fbb786720b6d0ceb4ff8d65b66645782c | |
parent | 2628155fc9947dcf463938553f057c39ccc2227a (diff) | |
download | rockbox-a4a5f5f33fd79ed625c280ac779f41d547846fe8.tar.gz rockbox-a4a5f5f33fd79ed625c280ac779f41d547846fe8.zip |
Check core max allocations for valid handle
fix rolo warnings
Change-Id: Ia2c669a5517aec54e5b2c0dc5934c88a4f49f2a9
-rw-r--r-- | apps/radio/radioart.c | 7 | ||||
-rw-r--r-- | apps/tagtree.c | 3 | ||||
-rw-r--r-- | firmware/rolo.c | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/apps/radio/radioart.c b/apps/radio/radioart.c index 87d37cd52c..1fd82dae68 100644 --- a/apps/radio/radioart.c +++ b/apps/radio/radioart.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "string-extra.h" | 33 | #include "string-extra.h" |
34 | #include "pathfuncs.h" | 34 | #include "pathfuncs.h" |
35 | #include "core_alloc.h" | 35 | #include "core_alloc.h" |
36 | #include "splash.h" | ||
36 | 37 | ||
37 | #define MAX_RADIOART_IMAGES 10 | 38 | #define MAX_RADIOART_IMAGES 10 |
38 | struct radioart { | 39 | struct radioart { |
@@ -202,6 +203,12 @@ void radioart_init(bool entering_screen) | |||
202 | /* grab control over buffering */ | 203 | /* grab control over buffering */ |
203 | size_t bufsize; | 204 | size_t bufsize; |
204 | int handle = core_alloc_maximum("radioart", &bufsize, &radioart_ops); | 205 | int handle = core_alloc_maximum("radioart", &bufsize, &radioart_ops); |
206 | if (handle <0) | ||
207 | { | ||
208 | splash(HZ, "Radioart Failed - OOM"); | ||
209 | return; | ||
210 | } | ||
211 | |||
205 | buffering_reset(core_get_data(handle), bufsize); | 212 | buffering_reset(core_get_data(handle), bufsize); |
206 | buf = core_get_data(handle); | 213 | buf = core_get_data(handle); |
207 | /* one-shot */ | 214 | /* one-shot */ |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 97e0c67b62..4b118f6d0d 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -1258,6 +1258,9 @@ void tagtree_init(void) | |||
1258 | menu = NULL; | 1258 | menu = NULL; |
1259 | rootmenu = -1; | 1259 | rootmenu = -1; |
1260 | tagtree_handle = core_alloc_maximum("tagtree", &tagtree_bufsize, &ops); | 1260 | tagtree_handle = core_alloc_maximum("tagtree", &tagtree_bufsize, &ops); |
1261 | if (tagtree_handle < 0) | ||
1262 | panicf("tagtree OOM"); | ||
1263 | |||
1261 | if (!parse_menu(FILE_SEARCH_INSTRUCTIONS)) | 1264 | if (!parse_menu(FILE_SEARCH_INSTRUCTIONS)) |
1262 | { | 1265 | { |
1263 | tagtree_unload(NULL); | 1266 | tagtree_unload(NULL); |
diff --git a/firmware/rolo.c b/firmware/rolo.c index f4db832b2b..f1bcd0718e 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c | |||
@@ -244,7 +244,7 @@ int rolo_load(const char* filename) | |||
244 | rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL); | 244 | rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL); |
245 | if (rolo_handle < 0) | 245 | if (rolo_handle < 0) |
246 | { | 246 | { |
247 | splash(HZ, "Rolo Failed - OOM"); | 247 | rolo_error("OOM"); |
248 | return -1; | 248 | return -1; |
249 | } | 249 | } |
250 | 250 | ||