forked from drath/libratbag
Only reset the driver to NULL on unusual exits
If a driver succeeded but then fails sanity checks, leave the driver set and let the cleanup code handle the rest. Otherwise, memory allocated by the driver's probe() function is never released. Fixes a valgrind memory leak complaint when running tests for invalid devices (e.g. device_profiles_num_0). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
a9c4f46412
commit
5637755345
@@ -328,9 +328,8 @@ ratbag_test_driver(struct ratbag_device *device,
|
||||
log_error(ratbag, "%s: error opening hidraw node (%s)\n",
|
||||
device->name, strerror(-rc));
|
||||
|
||||
error:
|
||||
device->driver = NULL;
|
||||
|
||||
error:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user