Change a malloc to calloc.

This commit is contained in:
nicm
2026-06-30 20:27:36 +00:00
parent f8674cc993
commit eda7e563d0

13
grid.c
View File

@@ -308,27 +308,16 @@ grid_create(u_int sx, u_int sy, u_int hlimit)
{ {
struct grid *gd; struct grid *gd;
gd = xmalloc(sizeof *gd); gd = xcalloc(1, sizeof *gd);
gd->sx = sx; gd->sx = sx;
gd->sy = sy; gd->sy = sy;
if (hlimit != 0) if (hlimit != 0)
gd->flags = GRID_HISTORY; gd->flags = GRID_HISTORY;
else
gd->flags = 0;
gd->hscrolled = 0;
gd->hsize = 0;
gd->hlimit = hlimit; gd->hlimit = hlimit;
gd->scroll_added = 0;
gd->scroll_collected = 0;
gd->scroll_generation = 0;
if (gd->sy != 0) if (gd->sy != 0)
gd->linedata = xcalloc(gd->sy, sizeof *gd->linedata); gd->linedata = xcalloc(gd->sy, sizeof *gd->linedata);
else
gd->linedata = NULL;
return (gd); return (gd);
} }