added typecast for a malloc() return, and added check for NULL

This commit is contained in:
Daniel Stenberg 2002-01-18 10:30:51 +00:00
parent 8edfb370a8
commit cbaecca8e9
2 changed files with 8 additions and 2 deletions

View File

@ -101,7 +101,10 @@ curl_hash_alloc(int slots, curl_hash_dtor dtor)
{ {
curl_hash *h; 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); curl_hash_init(h, slots, dtor);
return h; return h;

View File

@ -46,7 +46,10 @@ curl_llist_alloc(curl_llist_dtor dtor)
{ {
curl_llist *list; 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); curl_llist_init(list, dtor);
return list; return list;