From a956672a338292e4e7d9b4f910c82cf9e64466f8 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 27 Jul 2011 02:26:49 +0000 Subject: [PATCH] * Fix a few spots where we were checking for NULL unneededly * Fix a few spots where we *should* of been checking for NULL to prevent referencing a null pointer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42505 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/radeon_hd/accelerant.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp index bc47945f13..b4a8aa7f51 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp +++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp @@ -168,22 +168,24 @@ init_common(int device, bool isClone) static void uninit_common(void) { - delete_area(gInfo->regs_area); - delete_area(gInfo->shared_info_area); + if (gInfo != NULL) { + delete_area(gInfo->regs_area); + delete_area(gInfo->shared_info_area); - gInfo->regs_area = gInfo->shared_info_area = -1; + gInfo->regs_area = gInfo->shared_info_area = -1; - // close the file handle ONLY if we're the clone - if (gInfo->is_clone) - close(gInfo->device); + // close the file handle ONLY if we're the clone + if (gInfo->is_clone) + close(gInfo->device); - free(gInfo); + free(gInfo); + } for (uint32 id = 0; id < MAX_DISPLAY; id++) { - if (gDisplay[id]->regs != NULL) + if (gDisplay[id] != NULL) { free(gDisplay[id]->regs); - if (gDisplay[id] != NULL) free(gDisplay[id]); + } } }