Merge pull request #2518 from heuripedes/master

Fix some potential null derefs
This commit is contained in:
Twinaphex 2015-12-04 01:26:27 +01:00
commit 8c6f0be6e9
3 changed files with 15 additions and 8 deletions

View File

@ -611,14 +611,16 @@ static bool init_video_pixel_converter(unsigned size)
return true;
error:
if (video_driver_scaler_ptr->scaler_out)
free(video_driver_scaler_ptr->scaler_out);
if (video_driver_scaler_ptr->scaler)
free(video_driver_scaler_ptr->scaler);
if (video_driver_scaler_ptr)
free(video_driver_scaler_ptr);
{
if (video_driver_scaler_ptr->scaler_out)
free(video_driver_scaler_ptr->scaler_out);
if (video_driver_scaler_ptr->scaler)
free(video_driver_scaler_ptr->scaler);
video_driver_scaler_ptr = NULL;
free(video_driver_scaler_ptr);
video_driver_scaler_ptr = NULL;
}
return false;
}

View File

@ -242,8 +242,10 @@ unsigned video_texture_load(void *data,
static void video_texture_gl_unload(uintptr_t *id)
{
if (id)
{
glDeleteTextures(1, (const GLuint*)id);
*id = 0;
*id = 0;
}
}
#endif

View File

@ -56,8 +56,11 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
int i, j = 0;
char *line_start = buf;
if (!buf)
if (!buf || !buf_size)
{
menu_entries_push(list, "No entries to display.", "", MENU_FILE_NONE, 0, 0);
return;
}
for (i = 0; i < buf_size; i++)
{