summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2002-09-23 10:43:02 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2002-09-23 10:43:02 +0000
commit94fa5fe14a6c0aa4aebd2b59af961c5487204ac0 (patch)
tree761270e4a74d2777c88ba19eaf99985c9cb2a4f0
parent1d22386aff693d96bb68fe9ead529ba33ec555e3 (diff)
Guard radeon_mem_release and radeon_mem_takedown against null heaps.
-rw-r--r--shared-core/radeon_mem.c6
-rw-r--r--shared/radeon_mem.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/shared-core/radeon_mem.c b/shared-core/radeon_mem.c
index 5488313c..d77c60b9 100644
--- a/shared-core/radeon_mem.c
+++ b/shared-core/radeon_mem.c
@@ -174,6 +174,9 @@ void radeon_mem_release( struct mem_block *heap )
int pid = DRM_CURRENTPID;
struct mem_block *p;
+ if (!heap || !heap->next)
+ return;
+
for (p = heap->next ; p != heap ; p = p->next) {
if (p->pid == pid)
p->pid = 0;
@@ -198,6 +201,9 @@ void radeon_mem_release( struct mem_block *heap )
void radeon_mem_takedown( struct mem_block **heap )
{
struct mem_block *p;
+
+ if (!*heap)
+ return;
for (p = (*heap)->next ; p != *heap ; ) {
struct mem_block *q = p;
diff --git a/shared/radeon_mem.c b/shared/radeon_mem.c
index 5488313c..d77c60b9 100644
--- a/shared/radeon_mem.c
+++ b/shared/radeon_mem.c
@@ -174,6 +174,9 @@ void radeon_mem_release( struct mem_block *heap )
int pid = DRM_CURRENTPID;
struct mem_block *p;
+ if (!heap || !heap->next)
+ return;
+
for (p = heap->next ; p != heap ; p = p->next) {
if (p->pid == pid)
p->pid = 0;
@@ -198,6 +201,9 @@ void radeon_mem_release( struct mem_block *heap )
void radeon_mem_takedown( struct mem_block **heap )
{
struct mem_block *p;
+
+ if (!*heap)
+ return;
for (p = (*heap)->next ; p != *heap ; ) {
struct mem_block *q = p;