From: Christophe CURIS <[email protected]> As pointed by Coverity, if there is a problem when reading the binary data of an RImage from a file, the area allocated to store it would not be freed.
Signed-off-by: Christophe CURIS <[email protected]> --- WPrefs.app/Appearance.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index f67975d..0535495 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -1276,13 +1276,13 @@ static Pixmap loadRImage(WMScreen * scr, const char *path) } image = RCreateImage(w, h, d == 4); read_size = w * h * d; - if (fread(image->data, 1, read_size, f) != read_size) { - fclose(f); - return None; - } + if (fread(image->data, 1, read_size, f) == read_size) + RConvertImage(WMScreenRContext(scr), image, &pixmap); + else + pixmap = None; + fclose(f); - RConvertImage(WMScreenRContext(scr), image, &pixmap); RReleaseImage(image); return pixmap; -- 1.9.2 -- To unsubscribe, send mail to [email protected].
