Re: [PATCH] setfont: explicitly initialize ptr to NULL
Alexey Gladkov <[email protected]> Fri, 13 Feb 2026 11:33:35 +0100
| Newsgroups | dev.linux.lists.kbd |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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