Fix checks on buflib allocated handles (0 is not a valid handle value)
Change-Id: I8fdc5a59a5062f40a431cd49971390e21631b8ec
This commit is contained in:
parent
900cf6d52b
commit
d023bf0f5d
6 changed files with 7 additions and 7 deletions
|
@ -344,7 +344,7 @@ void filetype_init(void)
|
|||
|
||||
strdup_bufsize = filesize(fd);
|
||||
strdup_handle = core_alloc_ex("filetypes", strdup_bufsize, &ops);
|
||||
if (strdup_handle < 0)
|
||||
if (strdup_handle <= 0)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
|
|
|
@ -197,7 +197,7 @@ static void load_icons(const char* filename, enum Iconset iconset,
|
|||
size_t buf_size = read_bmp_fd(fd, &ic->bmp, 0,
|
||||
bmpformat|FORMAT_RETURN_SIZE, NULL);
|
||||
ic->handle = core_alloc_ex(filename, buf_size, &buflib_ops);
|
||||
if (ic->handle < 0)
|
||||
if (ic->handle <= 0)
|
||||
{
|
||||
close(fd);
|
||||
return;
|
||||
|
|
|
@ -245,7 +245,7 @@ void skin_backdrop_load_setting(void)
|
|||
backdrops[i].buflib_handle =
|
||||
core_alloc_ex(global_settings.backdrop_file,
|
||||
LCD_BACKDROP_BYTES, &buflib_ops);
|
||||
if (backdrops[i].buflib_handle < 0)
|
||||
if (backdrops[i].buflib_handle <= 0)
|
||||
return;
|
||||
}
|
||||
bool loaded;
|
||||
|
|
|
@ -1665,7 +1665,7 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
|
|||
size_t buf_size = read_bmp_fd(fd, bitmap, 0,
|
||||
format|FORMAT_RETURN_SIZE, NULL);
|
||||
handle = core_alloc_ex(bitmap->data, buf_size, &buflib_ops);
|
||||
if (handle < 0)
|
||||
if (handle <= 0)
|
||||
{
|
||||
DEBUGF("Not enough skin buffer: need %zd more.\n",
|
||||
buf_size - skin_buffer_freespace());
|
||||
|
@ -2315,7 +2315,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
|
|||
#ifndef __PCTOOL__
|
||||
wps_data->buflib_handle = core_alloc(isfile ? buf : "failsafe skin",
|
||||
skin_buffer_usage());
|
||||
if (wps_data->buflib_handle >= 0)
|
||||
if (wps_data->buflib_handle > 0)
|
||||
{
|
||||
wps_data->wps_loaded = true;
|
||||
memcpy(core_get_data(wps_data->buflib_handle), skin_buffer,
|
||||
|
|
|
@ -255,7 +255,7 @@ int scrobbler_init(void)
|
|||
return -1;
|
||||
|
||||
scrobbler_cache = core_alloc("scrobbler", SCROBBLER_MAX_CACHE*SCROBBLER_CACHE_LEN);
|
||||
if (scrobbler_cache < 0)
|
||||
if (scrobbler_cache <= 0)
|
||||
{
|
||||
logf("SCROOBLER: OOM");
|
||||
return -1;
|
||||
|
|
|
@ -514,7 +514,7 @@ int font_load_ex( const char *path, size_t buf_size, int glyphs )
|
|||
int handle = core_alloc_ex( path,
|
||||
bufsize + sizeof( struct buflib_alloc_data ),
|
||||
&buflibops );
|
||||
if ( handle < 0 )
|
||||
if ( handle <= 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue