Hi,
This series fixes a large set of memory leaks that can be observed when
scanning for devices. Some of these leaks are driver specific and are fixed
in their respective drivers. But there is also one leak that is systematic.
Most drivers fail to free the drv_context struct that is allocated in
std_init(). To address this a new helper function called std_cleanup() is
introduced which will free the drv_context, but in addition also call
sr_dev_clear() to either call the drivers dev_clear() callback or
std_dev_clear(). This not only fixes the memory leak but also allows to
remove all driver specific cleanup callbacks removing a large amount of
boiler-plate code.
Valgrind leak statistics for `sigrok-cli --scan` before the patch set
==11844== LEAK SUMMARY:
==11844== definitely lost: 2,368 bytes in 136 blocks
==11844== indirectly lost: 10,344 bytes in 16 blocks
==11844== possibly lost: 44,044 bytes in 117 blocks
==11844== still reachable: 23,597 bytes in 24 blocks
==11844== suppressed: 0 bytes in 0 blocks
Valgrind leak statistics for `sigrok-cli --scan` after the patch set
==27343== LEAK SUMMARY:
==27343== definitely lost: 0 bytes in 0 blocks
==27343== indirectly lost: 0 bytes in 0 blocks
==27343== possibly lost: 0 bytes in 0 blocks
==27343== still reachable: 22,953 bytes in 20 blocks
==27343== suppressed: 0 bytes in 0 blocks
The last two patches in this series remove additional boiler-plate code by
removing all dev_clear() implementation that implement the default behavior
and by introducing a new standard helper function for retrieving the
drivers device list.
- Lars
Lars-Peter Clausen (9):
ftdi-la: Properly cleanup in scan_all()
baylibre-acme: Properly free GErrors returned by g_file_get_contents()
beaglelogic: Use std_dev_clear() instead of open-coding it
demo: Provide dev_clear()
deree-de5000: Provide dev_clear()
scpi-pps: Fix dev_clear() implementation
Introduce standard cleanup helper
Remove unnecessary dev_clear() callbacks
Introduce standard implementation of the dev_list callback
src/hardware/agilent-dmm/api.c | 14 ++--------
src/hardware/appa-55ii/api.c | 14 ++--------
src/hardware/arachnid-labs-re-load-pro/api.c | 20 ++------------
src/hardware/asix-sigma/api.c | 14 ++--------
src/hardware/atten-pps3xxx/api.c | 14 ++--------
src/hardware/baylibre-acme/api.c | 22 ++-------------
src/hardware/baylibre-acme/protocol.c | 3 ++
src/hardware/beaglelogic/api.c | 38 ++------------------------
src/hardware/brymen-bm86x/api.c | 14 ++--------
src/hardware/brymen-dmm/api.c | 14 ++--------
src/hardware/cem-dt-885x/api.c | 14 ++--------
src/hardware/center-3xx/api.c | 32 ++--------------------
src/hardware/chronovu-la/api.c | 14 ++--------
src/hardware/colead-slm/api.c | 14 ++--------
src/hardware/conrad-digi-35-cpu/api.c | 14 ++--------
src/hardware/demo/demo.c | 13 +++------
src/hardware/deree-de5000/api.c | 13 +++------
src/hardware/fluke-dmm/api.c | 14 ++--------
src/hardware/ftdi-la/api.c | 22 ++++-----------
src/hardware/fx2lafw/api.c | 24 ++--------------
src/hardware/gmc-mh-1x-2x/api.c | 18 +++---------
src/hardware/gwinstek-gds-800/api.c | 22 ++-------------
src/hardware/hameg-hmo/api.c | 16 ++---------
src/hardware/hantek-6xxx/api.c | 14 ++--------
src/hardware/hantek-dso/api.c | 14 ++--------
src/hardware/hp-3457a/api.c | 20 ++------------
src/hardware/hung-chang-dso-2100/api.c | 21 ++------------
src/hardware/ikalogic-scanalogic2/api.c | 14 ++--------
src/hardware/ikalogic-scanaplus/api.c | 14 ++--------
src/hardware/kecheng-kc-330b/api.c | 24 ++--------------
src/hardware/kern-scale/api.c | 20 ++------------
src/hardware/korad-kaxxxxp/api.c | 21 ++------------
src/hardware/lascar-el-usb/api.c | 24 ++--------------
src/hardware/lecroy-logicstudio/api.c | 29 ++------------------
src/hardware/link-mso19/api.c | 14 ++--------
src/hardware/manson-hcs-3xxx/api.c | 20 ++------------
src/hardware/maynuo-m97/api.c | 20 ++------------
src/hardware/mic-985xx/api.c | 32 ++--------------------
src/hardware/motech-lps-30x/api.c | 14 ++--------
src/hardware/norma-dmm/api.c | 18 +++---------
src/hardware/openbench-logic-sniffer/api.c | 14 ++--------
src/hardware/pipistrello-ols/api.c | 14 ++--------
src/hardware/rigol-ds/api.c | 14 ++--------
src/hardware/saleae-logic16/api.c | 24 ++--------------
src/hardware/scpi-pps/api.c | 16 ++---------
src/hardware/serial-dmm/api.c | 20 ++------------
src/hardware/sysclk-lwla/api.c | 11 ++------
src/hardware/teleinfo/api.c | 14 ++--------
src/hardware/testo/api.c | 29 ++------------------
src/hardware/tondaj-sl-814/api.c | 14 ++--------
src/hardware/uni-t-dmm/api.c | 20 ++------------
src/hardware/uni-t-ut32x/api.c | 24 ++--------------
src/hardware/victor-dmm/api.c | 24 ++--------------
src/hardware/yokogawa-dlm/api.c | 16 ++---------
src/hardware/zeroplus-logic-cube/api.c | 14 ++--------
src/libsigrok-internal.h | 2 ++
src/std.c | 41 ++++++++++++++++++++++++++++
57 files changed, 167 insertions(+), 874 deletions(-)
--
2.1.4
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel