File 0001-libkfont-Initialize-kfont_context-options.patch of Package kbd.29031

From 501efd7b873e1462da986f763398ea8d98df2767 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Fri, 14 Jan 2022 15:22:24 +0100
Subject: [PATCH] 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>
---
 src/libkfont/context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libkfont/context.c b/src/libkfont/context.c
index 9ce0975351be..d5a766606489 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;
-- 
2.34.0

openSUSE Build Service is sponsored by