summaryrefslogtreecommitdiff
path: root/src/font.c
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2001-07-22 03:25:23 +0000
committerMichael Jennings <mej@kainx.org>2001-07-22 03:25:23 +0000
commit1d362467ee10d5b424f4f2e3500f043013e854db (patch)
tree0f48716ccc2b86bbe64deb3f78df97a77afdb43d /src/font.c
parent44b1e5126c355eb376a39f51652b44c174c1469d (diff)
downloadeterm-1d362467ee10d5b424f4f2e3500f043013e854db.tar.gz
Sat Jul 21 20:22:26 2001 Michael Jennings (mej)
Although I have yet to be able to reproduce it, I believe this will fix Debian bug #104393. I don't think the lower parts of that array were getting properly zeroed. :( SVN revision: 4975
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/font.c b/src/font.c
index 879c5d8..0ce0878 100644
--- a/src/font.c
+++ b/src/font.c
@@ -75,30 +75,30 @@ eterm_font_add(char ***plist, const char *fontname, unsigned char idx) {
unsigned char new_size = sizeof(char *) * (idx + 1);
/* The below looks messy with all the cpp stuff, but it really just malloc's/realloc's
- both etfonts and etmfonts at the same time to the same size, then prints some goop. */
+ both etfonts and etmfonts at the same time to the same size, zeros all the new
+ memory space using MEMSET(), and then prints some goop. */
if (etfonts) {
etfonts = (char **) REALLOC(etfonts, new_size);
+ MEMSET(etfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
#ifdef MULTI_CHARSET
etmfonts = (char **) REALLOC(etmfonts, new_size);
+ MEMSET(etmfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
D_FONT((" -> Reallocated font lists: %u bytes at %8p/%8p\n", new_size, etfonts, etmfonts));
#else
D_FONT((" -> Reallocated font list: %u bytes at %8p\n", new_size, etfonts));
#endif
} else {
etfonts = (char **) MALLOC(new_size);
+ MEMSET(etfonts, 0, new_size);
#ifdef MULTI_CHARSET
etmfonts = (char **) MALLOC(new_size);
+ MEMSET(etmfonts, 0, new_size);
D_FONT((" -> Allocated font lists: %u bytes at %8p/%8p\n", new_size, etfonts, etmfonts));
#else
D_FONT((" -> Allocating font list: %u bytes at %8p\n", new_size, etfonts));
#endif
}
- /* Initialize the new memory so we don't think it's got valid font info. */
- MEMSET(etfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
-#ifdef MULTI_CHARSET
- MEMSET(etmfonts + font_cnt, 0, sizeof(char *) * (idx - font_cnt + 1));
-#endif
font_cnt = idx + 1; /* Update the font count. */
#ifdef MULTI_CHARSET
flist = ((plist == &etfonts) ? (etfonts) : (etmfonts));