[PATCH v4 4/4] DRI2: Use single error path in initialization

Pauli Nieminen ext-pauli.nieminen at nokia.com
Fri Apr 30 04:10:03 PDT 2010


Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 hw/xfree86/dri2/dri2.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index b20e96d..f4f34cc 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -868,18 +868,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 	/* Driver too old: use the old-style driverName field */
 	ds->numDrivers = 1;
 	ds->driverNames = xalloc(sizeof(*ds->driverNames));
-	if (!ds->driverNames) {
-	    xfree(ds);
-	    return FALSE;
-	}
+	if (!ds->driverNames)
+	    goto err_out;
 	ds->driverNames[0] = info->driverName;
     } else {
 	ds->numDrivers = info->numDrivers;
 	ds->driverNames = xalloc(info->numDrivers * sizeof(*ds->driverNames));
-	if (!ds->driverNames) {
-	    xfree(ds);
-	    return FALSE;
-	}
+	if (!ds->driverNames)
+		goto err_out;
 	memcpy(ds->driverNames, info->driverNames,
 	       info->numDrivers * sizeof(*ds->driverNames));
     }
-- 
1.6.3.3



More information about the xorg-devel mailing list