From: Alexey Gladkov <legion@kernel.org>
To: Krdyan Areg <areg.krdian@gmail.com>
Cc: kbd@lists.linux.dev
Subject: Re: [PATCH] setfont: explicitly initialize ptr to NULL
Date: Fri, 13 Feb 2026 11:33:35 +0100 [thread overview]
Message-ID: <aY79_0hN1RYSftAb@example.org> (raw)
In-Reply-To: <20260212141339.1187595-1-areg.krdian@gmail.com>
On Thu, Feb 12, 2026 at 05:13:39PM +0300, Krdyan Areg wrote:
> Variable 'ptr' is declared but not initialized. If an error occurs before
> the first loop iteration, the error path at 'end' label calls free(ptr)
> on an uninitialized pointer.
>
> Signed-off-by: Krdyan Areg <areg.krdian@gmail.com>
Applied. Thanks!
> ---
> src/libkfont/setfont.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libkfont/setfont.c b/src/libkfont/setfont.c
> index 45652c0..06dc425 100644
> --- a/src/libkfont/setfont.c
> +++ b/src/libkfont/setfont.c
> @@ -281,7 +281,7 @@ kfont_load_fonts(struct kfont_context *ctx,
> unsigned char *inbuf, *fontbuf, *bigfontbuf;
> unsigned int inputlth, fontbuflth, fontsize, height, width;
> unsigned int bigfontbuflth, bigfontsize, bigheight, bigwidth;
> - unsigned char *ptr;
> + unsigned char *ptr = NULL;
> struct unicode_list *uclistheads;
> struct kbdfile *fp = NULL;
> int i;
> --
> 2.52.0
>
>
--
Rgrds, legion
prev parent reply other threads:[~2026-02-13 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 14:13 [PATCH] setfont: explicitly initialize ptr to NULL Krdyan Areg
2026-02-13 10:33 ` Alexey Gladkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aY79_0hN1RYSftAb@example.org \
--to=legion@kernel.org \
--cc=areg.krdian@gmail.com \
--cc=kbd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox