diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2012-06-10 17:15:47 +0200 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2012-06-10 17:15:47 +0200 |
commit | d023bf0f5dedb67caf9229e3ddcbb5a9fea420ce (patch) | |
tree | 3562a23f7eb6009e161cbc8aae943de33d168b91 /apps/gui/skin_engine/skin_parser.c | |
parent | 900cf6d52bd806bd54ad2118e245cd3465ea6815 (diff) | |
download | rockbox-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/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
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, |