aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Vogt <fvogt@suse.de>2022-01-14 15:22:24 +0100
committerFabian Vogt <fvogt@suse.de>2022-01-14 15:24:01 +0100
commit501efd7b873e1462da986f763398ea8d98df2767 (patch)
treea3a0c65da537a3c94d4d8ce00bd41153e556d916
parentdbcfed491ac62e815a441fd0ed6ae2ce5d6c5ee3 (diff)
downloadkbd-501efd7b873e1462da986f763398ea8d98df2767.tar.gz
libkfont: Initialize kfont_context->options
kfont_init did not set the options member, so it had essentially random content. This made setfont behave weirdly. Switch to calloc for good measure to avoid issues like this. Signed-off-by: Fabian Vogt <fvogt@suse.de>
-rw-r--r--src/libkfont/context.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libkfont/context.c b/src/libkfont/context.c
index 9ce09753..d5a76660 100644
--- a/src/libkfont/context.c
+++ b/src/libkfont/context.c
@@ -143,11 +143,12 @@ kfont_init(const char *prefix, struct kfont_context **ctx)
{
struct kfont_context *p;
- if (!(p = malloc(sizeof(*p))))
+ if (!(p = calloc(1, sizeof(*p))))
return -EX_OSERR;
p->progname = prefix;
p->verbose = 0;
+ p->options = 0;
p->log_fn = log_stderr;
p->mapdirpath = mapdirpath;
p->mapsuffixes = mapsuffixes;