summaryrefslogtreecommitdiff
path: root/linux/sis_ds.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2003-01-26 07:43:50 +0000
committerIan Romanick <idr@us.ibm.com>2003-01-26 07:43:50 +0000
commit3163f74b8eddf97bc9a71f01dfa02d2d33091b62 (patch)
treecf0741bf2f3dabe273f2dfaf698891ea19a4c2bc /linux/sis_ds.c
parenta790687c9a4b369094a2a56e29a8240db573a54a (diff)
Diffstat (limited to 'linux/sis_ds.c')
-rw-r--r--linux/sis_ds.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/linux/sis_ds.c b/linux/sis_ds.c
index 95880a482..f55cf6ab4 100644
--- a/linux/sis_ds.c
+++ b/linux/sis_ds.c
@@ -50,15 +50,16 @@ set_t *setInit(void)
set_t *set;
set = (set_t *)MALLOC(sizeof(set_t));
- for(i = 0; i < SET_SIZE; i++){
- set->list[i].free_next = i+1;
- set->list[i].alloc_next = -1;
- }
- set->list[SET_SIZE-1].free_next = -1;
- set->free = 0;
- set->alloc = -1;
- set->trace = -1;
-
+ if (set) {
+ for(i = 0; i < SET_SIZE; i++){
+ set->list[i].free_next = i+1;
+ set->list[i].alloc_next = -1;
+ }
+ set->list[SET_SIZE-1].free_next = -1;
+ set->free = 0;
+ set->alloc = -1;
+ set->trace = -1;
+ }
return set;
}
@@ -172,7 +173,8 @@ static void *calloc(size_t nmemb, size_t size)
{
void *addr;
addr = kmalloc(nmemb*size, GFP_KERNEL);
- memset(addr, 0, nmemb*size);
+ if (addr)
+ memset(addr, 0, nmemb*size);
return addr;
}
#define free(n) kfree(n)