diff options
author | marha <marha@users.sourceforge.net> | 2011-05-16 09:49:27 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-05-16 09:49:27 +0000 |
commit | ab5c2d2c78273ccdc7c9734bcba482a33fcf9652 (patch) | |
tree | d12aaeba9956621fe7429d94a7c90105fe306b42 /xorg-server/dbe/dbe.c | |
parent | 421ecdd3ee6f691c63c4568944423d986f9f69db (diff) | |
parent | 08cbf3b50bfe713044f36b363c73768cd042f13c (diff) | |
download | vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.tar.gz vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.tar.bz2 vcxsrv-ab5c2d2c78273ccdc7c9734bcba482a33fcf9652.zip |
merge ^/branches/released .
Diffstat (limited to 'xorg-server/dbe/dbe.c')
-rw-r--r-- | xorg-server/dbe/dbe.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/xorg-server/dbe/dbe.c b/xorg-server/dbe/dbe.c index d1074a2fb..5b5049848 100644 --- a/xorg-server/dbe/dbe.c +++ b/xorg-server/dbe/dbe.c @@ -690,8 +690,7 @@ ProcDbeGetVisualInfo(ClientPtr client) }
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
- if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
- sizeof(XdbeScreenVisualInfo))))
+ if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo))))
{
free(pDrawables);
@@ -707,21 +706,16 @@ ProcDbeGetVisualInfo(ClientPtr client) pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
- if ((rc != Success) ||
- !(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
+ if (rc != Success)
+ goto freeScrVisInfo;
+
+ if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
{
/* We failed to alloc pScrVisInfo[i].visinfo. */
+ rc = BadAlloc;
/* Free visinfos that we allocated for previous screen infos.*/
- for (j = 0; j < i; j++)
- {
- free(pScrVisInfo[j].visinfo);
- }
-
- /* Free pDrawables if we needed to allocate it above. */
- free(pDrawables);
-
- return (rc == Success) ? BadAlloc : rc;
+ goto freeScrVisInfo;
}
/* Account for n, number of xDbeVisInfo items in list. */
@@ -790,6 +784,9 @@ ProcDbeGetVisualInfo(ClientPtr client) }
}
+ rc = Success;
+
+ freeScrVisInfo:
/* Clean up memory. */
for (i = 0; i < count; i++)
{
@@ -799,7 +796,7 @@ ProcDbeGetVisualInfo(ClientPtr client) free(pDrawables);
- return Success;
+ return rc;
} /* ProcDbeGetVisualInfo() */
|