In grid_duplicate_lines, if the line is empty (cellsize == 0) then clear

the destination celldata pointer rather than leaving a stale copy of the
source pointer (which may later be freed). Fixes a crash found by
Kuang-che Wu.
pull/95/head
nicm 2015-08-24 22:49:13 +00:00
parent 58b659a26e
commit 3219e0314e
1 changed files with 2 additions and 1 deletions

3
grid.c
View File

@ -652,7 +652,8 @@ grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy,
srcl->cellsize, sizeof *dstl->celldata);
memcpy(dstl->celldata, srcl->celldata,
srcl->cellsize * sizeof *dstl->celldata);
}
} else
dstl->celldata = NULL;
sy++;
dy++;