std_init() allocates a drv_context struct which needs to be freed by the driver in its cleanup struct. But the vast majority of drivers does never does this causing memory leaks. Instead of addressing the issue by manually adding code to free the struct to each driver introduce a new helper function std_cleanup() that takes care of this. In addition to freeing the drv_context struct std_cleanup() also invokes sr_dev_clear() which takes care of freeing all devices attached to the driver. Combining both operations in the same helper function allows to use std_cleanup() as the cleanup callback for all existing drivers, which reduces the amount of boiler-plate code quite a bit. All drivers are updated to use the new helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> |
||
---|---|---|
.. | ||
api.c | ||
protocol.c | ||
protocol.h |