Handle NULL pointer as good as possible (Coverity #50099)
commitba8cd2abe47e30344cbeb99dcc7cf22d9730f4d3
authorChristophe CURIS <christophe.curis@free.fr>
Sat, 25 Apr 2015 10:44:21 +0000 (25 12:44 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 25 Apr 2015 11:53:06 +0000 (25 07:53 -0400)
tree50dcd1004d22481efa3243086845b937dd2aceb8
parent8d09af51b831bb3ae7ddc3d4599e82739d41d2ca
Handle NULL pointer as good as possible (Coverity #50099)

As pointed by Coverity, in the "Configuration" panel of WPrefs there are
some images loaded, but if the images cannot be loaded correctly then the
returned NULL pointer can crash the application as it is dereferenced in
further function calls.

To solve this case, this patch is adding a NULL pointer check in the
functions RScaleImage (wrlib) and WMCreatePixmapFromRImage (WINGs), so both
can accept that NULL pointer to also return NULL, which means the existing
check for "icon == NULL" in the WPrefs code will be useful.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WINGs/wpixmap.c
wrlib/scale.c