Clean up dangling pointers when freeing glyphmap
Partially fixes issue #941.
This commit is contained in:
@@ -363,6 +363,7 @@ void
|
|||||||
free_all_glyphmap_u(void)
|
free_all_glyphmap_u(void)
|
||||||
{
|
{
|
||||||
int glyph;
|
int glyph;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
|
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
|
||||||
if (glyphmap[glyph].u) {
|
if (glyphmap[glyph].u) {
|
||||||
@@ -374,6 +375,12 @@ free_all_glyphmap_u(void)
|
|||||||
glyphmap[glyph].u = 0;
|
glyphmap[glyph].u = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Prevent use after free from gg.gbuf */
|
||||||
|
for (y = 0; y < ROWNO; ++y) {
|
||||||
|
for (x = 0; x < COLNO; ++x) {
|
||||||
|
gg.gbuf[y][x].glyphinfo.gm.u = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper routine if a window port wants to embed any UTF-8 sequences
|
/* helper routine if a window port wants to embed any UTF-8 sequences
|
||||||
|
|||||||
Reference in New Issue
Block a user