[PATCH] setfont: explicitly initialize ptr to NULL
Krdyan Areg <[email protected]> Thu, 12 Feb 2026 17:13:39 +0300
| Newsgroups | dev.linux.lists.kbd |
|---|---|
| Message-ID | <[email protected]> |
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]> --- 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