setfont: explicitly initialize ptr to NULL
PATCH 1/1 setfont: explicitly initialize ptr to NULL
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(-)
src/libkfont/setfont.c +1 -1
@@ -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;
Signature · 1 line
2.52.0
Alexey Gladkov
AppliedQuoted 5 lines · Krdyan Areg
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!
Quoted 21 lines
--- src/libkfont/setfont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/libkfont/setfont.c +1
-1@@ -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;Signature · 1 line
2.52.0
Signature · 1 line
Rgrds, legion