Skip to content

Commit

Permalink
mraa.c: fix memleak in find_i2c_bus_pci
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Le Foll <[email protected]>
  • Loading branch information
arfoll committed Nov 4, 2016
1 parent dbcba5c commit 3d790a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mraa.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,15 @@ mraa_find_i2c_bus_pci(const char* pci_device, const char *pci_id, const char* ad
if (token != NULL) {
int ret = -1;
if (mraa_atoi(token, &ret) == MRAA_SUCCESS) {
free(dup);
free(namelist[n]);
free(namelist);
syslog(LOG_NOTICE, "Adding i2c bus found on i2c-%d on adapter %s", ret, adapter_name);
return ret;
}
free(dup);
free(namelist[n]);
free(namelist);
return -1;
}
}
Expand Down

0 comments on commit 3d790a8

Please sign in to comment.