Skip to content
Snippets Groups Projects
Commit 8ba254dd authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix missing NULL check/resource lead in bitmap_clrsrc()

Thanks Coverity!
parent ab122ee3
Branches
Tags
No related merge requests found
Pipeline #7714 passed
...@@ -1530,11 +1530,13 @@ void bitmap_clrscr(void) ...@@ -1530,11 +1530,13 @@ void bitmap_clrscr(void)
struct vstat_vmem *vmem_ptr; struct vstat_vmem *vmem_ptr;
size_t c = 0; size_t c = 0;
int rows, cols; int rows, cols;
struct vmem_cell *va = malloc(((cio_textinfo.winright - cio_textinfo.winleft + 1) * (cio_textinfo.winbottom - cio_textinfo.wintop + 1)) * sizeof(struct vmem_cell)); struct vmem_cell *va;
if(!bitmap_initialized) if(!bitmap_initialized)
return; return;
va = malloc(((cio_textinfo.winright - cio_textinfo.winleft + 1) * (cio_textinfo.winbottom - cio_textinfo.wintop + 1)) * sizeof(struct vmem_cell));
if (va == NULL)
return;
pthread_mutex_lock(&vstatlock); pthread_mutex_lock(&vstatlock);
vmem_ptr = get_vmem(&vstat); vmem_ptr = get_vmem(&vstat);
rows = vstat.rows; rows = vstat.rows;
...@@ -1545,6 +1547,7 @@ void bitmap_clrscr(void) ...@@ -1545,6 +1547,7 @@ void bitmap_clrscr(void)
} }
} }
bitmap_draw_vmem(cio_textinfo.winleft, cio_textinfo.wintop, cio_textinfo.winright, cio_textinfo.winbottom, va); bitmap_draw_vmem(cio_textinfo.winleft, cio_textinfo.wintop, cio_textinfo.winright, cio_textinfo.winbottom, va);
free(va);
release_vmem(vmem_ptr); release_vmem(vmem_ptr);
pthread_mutex_unlock(&vstatlock); pthread_mutex_unlock(&vstatlock);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment