From 4217db89ecd480fda2ee74fecba06c6713c2a0f0 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Mon, 7 Mar 2016 23:20:33 +0100 Subject: [PATCH] render: free already allocated formats in PictureInit failure case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Probably pointless, if this fails you're not likely to get far... Reviewed-by: Rémi Cardona Signed-off-by: Julien Cristau --- render/picture.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/render/picture.c b/render/picture.c index 6d9c9df3a..9e4036e7d 100644 --- a/render/picture.c +++ b/render/picture.c @@ -665,6 +665,9 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) for (n = 0; n < nformats; n++) { if (!AddResource (formats[n].id, PictFormatType, (void *) (formats + n))) { + int i; + for (i = 0; i < n; i++) + FreeResource(formats[i].id, RT_NONE); free(formats); return FALSE; }