[PATCH xserver 8/9] render: free already allocated formats in PictureInit failure case

Julien Cristau jcristau at debian.org
Mon Mar 7 22:20:33 UTC 2016


Probably pointless, if this fails you're not likely to get far...

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 render/picture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/render/picture.c b/render/picture.c
index 6d9c9df..9e4036e 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;
         }
-- 
2.7.0



More information about the xorg-devel mailing list