device/oprom/realmode/x86.c: Fix memory leak
Do not allocate memory if the bootsplash was not found. Found by Cppcheck 1.65. Fixes: [src/device/oprom/realmode/x86.c:280]: (error) Memory leak: decdata Change-Id: I8f8160d3d349c0c2b2a3ed84461729e9210153d8 Signed-off-by: Daniele Forsi <dforsi@gmail.com> Reviewed-on: http://review.coreboot.org/6376 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
c2519e5a06
commit
f9ce88e942
@ -270,7 +270,6 @@ void vbe_set_graphics(void)
|
|||||||
vbe_set_mode(&mode_info);
|
vbe_set_mode(&mode_info);
|
||||||
#if CONFIG_BOOTSPLASH
|
#if CONFIG_BOOTSPLASH
|
||||||
struct jpeg_decdata *decdata;
|
struct jpeg_decdata *decdata;
|
||||||
decdata = malloc(sizeof(*decdata));
|
|
||||||
unsigned char *jpeg = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
unsigned char *jpeg = cbfs_get_file_content(CBFS_DEFAULT_MEDIA,
|
||||||
"bootsplash.jpg",
|
"bootsplash.jpg",
|
||||||
CBFS_TYPE_BOOTSPLASH,
|
CBFS_TYPE_BOOTSPLASH,
|
||||||
@ -279,6 +278,7 @@ void vbe_set_graphics(void)
|
|||||||
printk(BIOS_DEBUG, "VBE: No bootsplash found.\n");
|
printk(BIOS_DEBUG, "VBE: No bootsplash found.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
decdata = malloc(sizeof(*decdata));
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);
|
ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user