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

Pauli Nieminen ext-pauli.nieminen at nokia.com
Fri May 28 09:13:52 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 c4878d1..2d4c7d3 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1066,18 +1066,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 	/* Driver too old: use the old-style driverName field */
 	ds->numDrivers = 1;
 	ds->driverNames = malloc(sizeof(*ds->driverNames));
-	if (!ds->driverNames) {
-	    free(ds);
-	    return FALSE;
-	}
+	if (!ds->driverNames)
+	    goto err_out;
 	ds->driverNames[0] = info->driverName;
     } else {
 	ds->numDrivers = info->numDrivers;
 	ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames));
-	if (!ds->driverNames) {
-	    free(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