mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
wrlib: initialise value for variable to avoid possible crash (Coverity #50245)
As pointed by Coverity, there's a free on the content of this buffer at function's end, but if the image's width or height is lower than 1 then we could reach this free before allocating anything, thus having an uninitialised pointer. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
907dd97e45
commit
173eaee9c2
@@ -132,6 +132,7 @@ RImage *RLoadJPEG(const char *file_name)
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
|
||||
if (cinfo.image_width < 1 || cinfo.image_height < 1) {
|
||||
buffer[0] = NULL; /* Initialize pointer to avoid spurious free in cleanup code */
|
||||
RErrorCode = RERR_BADIMAGEFILE;
|
||||
goto bye;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user