]> granicus.if.org Git - curl/commitdiff
added typecast for a malloc() return, and added check for NULL
authorDaniel Stenberg <daniel@haxx.se>
Fri, 18 Jan 2002 10:30:51 +0000 (10:30 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 18 Jan 2002 10:30:51 +0000 (10:30 +0000)
lib/hash.c
lib/llist.c

index 1ed3cc21a65ecc101ab71644e9ccd6e02938833d..15f2029c81d871e89db008499b5826db4958adb5 100644 (file)
@@ -101,7 +101,10 @@ curl_hash_alloc(int slots, curl_hash_dtor dtor)
 {
   curl_hash *h;
 
-  h = malloc(sizeof(curl_hash));
+  h = (curl_hash *)malloc(sizeof(curl_hash));
+  if(NULL = h)
+    return NULL;
+
   curl_hash_init(h, slots, dtor);
 
   return h;
index b031cf6ac660c070c77d81c418d9a2844c468d52..9103ff254be91e28ef364bc56a2a7e5b9cc0d6a1 100644 (file)
@@ -46,7 +46,10 @@ curl_llist_alloc(curl_llist_dtor dtor)
 {
   curl_llist *list;
 
-  list = malloc(sizeof(curl_llist));
+  list = (curl_llist *)malloc(sizeof(curl_llist));
+  if(NULL == list)
+    return NULL;
+
   curl_llist_init(list, dtor);
 
   return list;