intel / buxton

8 stars 9 forks source link

Fix Null check for calloc failure #152

Closed ya1gaurav closed 8 years ago

ya1gaurav commented 8 years ago

buxton_serialize_message() is called at many places after buxton_array_new() which returns memory allocated using calloc. However, in rare conditions if calloc failed it will return Null & hence buxton_serialize_message() will dereference Null (list). Adding assert(list) to fix such a case.

ikeydoherty commented 8 years ago

I can't really see a place where we subsequently call the function with an empty list, but it's not a harmful check so +1 from me.