From f0ab726d8966cab4e50154c216d577db79328d77 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Wed, 21 Apr 2010 11:07:47 +0300 Subject: [PATCH] DRI2: Use single error path in initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pauli Nieminen Reviewed-by: Kristian Høgsberg --- hw/xfree86/dri2/dri2.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index e1ccdae93..556285383 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)); }