Private
Public Access
2
0

spi.c: check memory allocation for context was succesful

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-11-19 23:45:35 +00:00
parent e84baf6636
commit d2ced53344

View File

@@ -105,6 +105,10 @@ mraa_spi_init(int bus)
}
mraa_spi_context dev = (mraa_spi_context) malloc(sizeof(struct _spi));
if (dev == NULL) {
syslog(LOG_CRIT, "spi: Failed to allocate memory for context");
return NULL;
}
memset(dev, 0, sizeof(struct _spi));
char path[MAX_SIZE];