Merge "Null check for malloc allocation"

This commit is contained in:
Linux Build Service Account 2013-10-20 00:13:23 -07:00 committed by Gerrit - the friendly Code Review server
commit 1f94c20487

View file

@ -42,6 +42,10 @@ static int open_gps(const struct hw_module_t* module, char const* name,
struct hw_device_t** device)
{
struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
if(dev == NULL)
return -1;
memset(dev, 0, sizeof(*dev));
dev->common.tag = HARDWARE_DEVICE_TAG;