Private
Public Access
2
0

coverity: Fix issues found by coverity scan

* Fix a few resource leaks in error conditions
* Makes strtol() calls safer in pwm module
* Make sure buffer is terminated after read() in aio

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-10-03 22:50:18 +01:00
parent 4e5ec299ed
commit 2b5e38b40c
6 changed files with 42 additions and 11 deletions

View File

@@ -69,6 +69,7 @@ mraa_intel_edison_pinmode_change(int sysfs, int mode)
char mode_buf[MAX_MODE_SIZE];
int length = sprintf(mode_buf, "mode%u",mode);
if (write(modef, mode_buf, length*sizeof(char)) == -1) {
close(modef);
return MRAA_ERROR_INVALID_RESOURCE;
}
close(modef);
@@ -404,6 +405,7 @@ mraa_intel_edison_fab_c()
if (tristate == NULL) {
syslog(LOG_CRIT, "Intel Edison Failed to initialise Arduino board TriState,\
check i2c devices! FATAL\n");
free(b);
return NULL;
}
mraa_gpio_dir(tristate, MRAA_GPIO_OUT);