Skip to content

Commit

Permalink
Coverity: fix util wmsetbg resource leak
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaciejak authored and crmafra committed Mar 3, 2023
1 parent 35f87b5 commit 7475bc5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion util/wmsetbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,15 @@ static BackgroundTexture *parseTexture(RContext * rc, char *text)
iheight = image->height;
}

GETSTRORGOTO(val, tmp, 2, error);
/* cannot use GETSTRORGOTO() here
* as we have to free image in case of error */
val = WMGetFromPLArray(texarray, 2);
if (!WMIsPLString(val)) {
wwarning("could not parse texture %s", text);
RReleaseImage(image);
goto error;
}
tmp = WMGetFromPLString(val);

if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
wwarning("could not parse color %s in texture %s", tmp, text);
Expand Down

0 comments on commit 7475bc5

Please sign in to comment.