summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2012-06-10 17:15:47 +0200
committerBertrik Sikken <bertrik@sikken.nl>2012-06-10 17:15:47 +0200
commitd023bf0f5dedb67caf9229e3ddcbb5a9fea420ce (patch)
tree3562a23f7eb6009e161cbc8aae943de33d168b91 /apps
parent900cf6d52bd806bd54ad2118e245cd3465ea6815 (diff)
downloadrockbox-d023bf0f5dedb67caf9229e3ddcbb5a9fea420ce.tar.gz
rockbox-d023bf0f5dedb67caf9229e3ddcbb5a9fea420ce.zip
Fix checks on buflib allocated handles (0 is not a valid handle value)
Change-Id: I8fdc5a59a5062f40a431cd49971390e21631b8ec
Diffstat (limited to 'apps')
-rw-r--r--apps/filetypes.c2
-rw-r--r--apps/gui/icon.c2
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c2
-rw-r--r--apps/gui/skin_engine/skin_parser.c4
-rw-r--r--apps/scrobbler.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 49196d40ed..b765e7a3b0 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -344,7 +344,7 @@ void filetype_init(void)
344 344
345 strdup_bufsize = filesize(fd); 345 strdup_bufsize = filesize(fd);
346 strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops); 346 strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
347 if (strdup_handle < 0) 347 if (strdup_handle <= 0)
348 { 348 {
349 close(fd); 349 close(fd);
350 return; 350 return;
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 46da38b765..f37cee969c 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -197,7 +197,7 @@ static void load_icons(const char* filename, enum Iconset iconset,
197 size_t buf_size = read_bmp_fd(fd, &ic->bmp, 0, 197 size_t buf_size = read_bmp_fd(fd, &ic->bmp, 0,
198 bmpformat|FORMAT_RETURN_SIZE, NULL); 198 bmpformat|FORMAT_RETURN_SIZE, NULL);
199 ic->handle = core_alloc_ex(filename, buf_size, &buflib_ops); 199 ic->handle = core_alloc_ex(filename, buf_size, &buflib_ops);
200 if (ic->handle < 0) 200 if (ic->handle <= 0)
201 { 201 {
202 close(fd); 202 close(fd);
203 return; 203 return;
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index edb895c56f..0d3c8b605f 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -245,7 +245,7 @@ void skin_backdrop_load_setting(void)
245 backdrops[i].buflib_handle = 245 backdrops[i].buflib_handle =
246 core_alloc_ex(global_settings.backdrop_file, 246 core_alloc_ex(global_settings.backdrop_file,
247 LCD_BACKDROP_BYTES, &buflib_ops); 247 LCD_BACKDROP_BYTES, &buflib_ops);
248 if (backdrops[i].buflib_handle < 0) 248 if (backdrops[i].buflib_handle <= 0)
249 return; 249 return;
250 } 250 }
251 bool loaded; 251 bool loaded;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 4784039a87..4de0aae3b2 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1665,7 +1665,7 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
1665 size_t buf_size = read_bmp_fd(fd, bitmap, 0, 1665 size_t buf_size = read_bmp_fd(fd, bitmap, 0,
1666 format|FORMAT_RETURN_SIZE, NULL); 1666 format|FORMAT_RETURN_SIZE, NULL);
1667 handle = core_alloc_ex(bitmap->data, buf_size, &buflib_ops); 1667 handle = core_alloc_ex(bitmap->data, buf_size, &buflib_ops);
1668 if (handle < 0) 1668 if (handle <= 0)
1669 { 1669 {
1670 DEBUGF("Not enough skin buffer: need %zd more.\n", 1670 DEBUGF("Not enough skin buffer: need %zd more.\n",
1671 buf_size - skin_buffer_freespace()); 1671 buf_size - skin_buffer_freespace());
@@ -2315,7 +2315,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
2315#ifndef __PCTOOL__ 2315#ifndef __PCTOOL__
2316 wps_data->buflib_handle = core_alloc(isfile ? buf : "failsafe skin", 2316 wps_data->buflib_handle = core_alloc(isfile ? buf : "failsafe skin",
2317 skin_buffer_usage()); 2317 skin_buffer_usage());
2318 if (wps_data->buflib_handle >= 0) 2318 if (wps_data->buflib_handle > 0)
2319 { 2319 {
2320 wps_data->wps_loaded = true; 2320 wps_data->wps_loaded = true;
2321 memcpy(core_get_data(wps_data->buflib_handle), skin_buffer, 2321 memcpy(core_get_data(wps_data->buflib_handle), skin_buffer,
diff --git a/apps/scrobbler.c b/apps/scrobbler.c
index 06c957cd6c..78414f3d88 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -255,7 +255,7 @@ int scrobbler_init(void)
255 return -1; 255 return -1;
256 256
257 scrobbler_cache = core_alloc("scrobbler", SCROBBLER_MAX_CACHE*SCROBBLER_CACHE_LEN); 257 scrobbler_cache = core_alloc("scrobbler", SCROBBLER_MAX_CACHE*SCROBBLER_CACHE_LEN);
258 if (scrobbler_cache < 0) 258 if (scrobbler_cache <= 0)
259 { 259 {
260 logf("SCROOBLER: OOM"); 260 logf("SCROOBLER: OOM");
261 return -1; 261 return -1;