mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
util: add proper check for null pointer in wmsetbg (Coverity #50198)
As pointed by Coverity, it is possible that the variable 'image' remains NULL in the function parseTexture, so this case must be checked appropriately where it is used. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
3250826215
commit
7c142f54d0
@@ -526,9 +526,8 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
|
|||||||
rcolor.blue = 0;
|
rcolor.blue = 0;
|
||||||
}
|
}
|
||||||
/* for images with a transparent color */
|
/* for images with a transparent color */
|
||||||
if (image->data[3]) {
|
if (image && image->data[3])
|
||||||
RCombineImageWithColor(image, &rcolor);
|
RCombineImageWithColor(image, &rcolor);
|
||||||
}
|
|
||||||
|
|
||||||
switch (toupper(type[0])) {
|
switch (toupper(type[0])) {
|
||||||
case 'T':
|
case 'T':
|
||||||
@@ -539,8 +538,6 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
|
|||||||
RReleaseImage(image);
|
RReleaseImage(image);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (image)
|
|
||||||
RReleaseImage(image);
|
|
||||||
|
|
||||||
texture->pixmap = pixmap;
|
texture->pixmap = pixmap;
|
||||||
texture->color = color;
|
texture->color = color;
|
||||||
@@ -560,6 +557,9 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
|
|||||||
texture->width = scrWidth;
|
texture->width = scrWidth;
|
||||||
texture->height = scrHeight;
|
texture->height = scrHeight;
|
||||||
|
|
||||||
|
if (!image)
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef USE_XINERAMA
|
#ifdef USE_XINERAMA
|
||||||
if (xineInfo.count && ! xineStretch) {
|
if (xineInfo.count && ! xineStretch) {
|
||||||
int i;
|
int i;
|
||||||
@@ -575,10 +575,12 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
|
|||||||
#else /* !USE_XINERAMA */
|
#else /* !USE_XINERAMA */
|
||||||
applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight);
|
applyImage(rc, texture, image, type[0], 0, 0, scrWidth, scrHeight);
|
||||||
#endif /* !USE_XINERAMA */
|
#endif /* !USE_XINERAMA */
|
||||||
RReleaseImage(image);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (image)
|
||||||
|
RReleaseImage(image);
|
||||||
|
|
||||||
} else if (strcasecmp(type, "thgradient") == 0
|
} else if (strcasecmp(type, "thgradient") == 0
|
||||||
|| strcasecmp(type, "tvgradient") == 0 || strcasecmp(type, "tdgradient") == 0) {
|
|| strcasecmp(type, "tvgradient") == 0 || strcasecmp(type, "tdgradient") == 0) {
|
||||||
XColor color;
|
XColor color;
|
||||||
|
|||||||
Reference in New Issue
Block a user