render: free already allocated formats in PictureInit failure case

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

Reviewed-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Julien Cristau <jcristau@debian.org>
(cherry picked from commit 4217db89ec)
This commit is contained in:
Julien Cristau 2016-03-07 23:20:33 +01:00 committed by Adam Jackson
parent 518a0c179f
commit b7e1f25005
1 changed files with 3 additions and 0 deletions

View File

@ -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;
}