When g_file_get_contents() encounters an error a new GError will be
allocated and passed back to the application. The application is
responsible for freeing this GError.
The baylibre-acme driver currently does not do this and as a result leaks
memory during the scan process when no device is found.
Add the missing g_error_free() invocations to fix the issue.
Signed-off-by: Lars-Peter Clausen <redacted>
sr_dbg("Name for probe %d can't be read: %s",
prb_num, err->message);
g_string_free(path, TRUE);
+ g_error_free(err);
return ret;
}
if (!dir) {
sr_err("Error opening %s: %s", path->str, err->message);
g_string_free(path, TRUE);
+ g_error_free(err);
return -1;
}
if (!status) {
sr_err("Error reading shunt resistance: %s", err->message);
ret = SR_ERR_IO;
+ g_error_free(err);
goto out;
}