mirror of
https://github.com/tmux/tmux.git
synced 2026-07-03 11:12:33 +08:00
Change a malloc to calloc.
This commit is contained in:
13
grid.c
13
grid.c
@@ -308,27 +308,16 @@ grid_create(u_int sx, u_int sy, u_int hlimit)
|
||||
{
|
||||
struct grid *gd;
|
||||
|
||||
gd = xmalloc(sizeof *gd);
|
||||
gd = xcalloc(1, sizeof *gd);
|
||||
gd->sx = sx;
|
||||
gd->sy = sy;
|
||||
|
||||
if (hlimit != 0)
|
||||
gd->flags = GRID_HISTORY;
|
||||
else
|
||||
gd->flags = 0;
|
||||
|
||||
gd->hscrolled = 0;
|
||||
gd->hsize = 0;
|
||||
gd->hlimit = hlimit;
|
||||
|
||||
gd->scroll_added = 0;
|
||||
gd->scroll_collected = 0;
|
||||
gd->scroll_generation = 0;
|
||||
|
||||
if (gd->sy != 0)
|
||||
gd->linedata = xcalloc(gd->sy, sizeof *gd->linedata);
|
||||
else
|
||||
gd->linedata = NULL;
|
||||
|
||||
return (gd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user