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 739861a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mraa.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,13 +957,20 @@ 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;
}
}
}
free(dup);
free(namelist[n]);
}
free(namelist);
Expand Down

0 comments on commit 739861a

Please sign in to comment.