]> sigrok.org Git - libsigrok.git/commit
sr_dev_clear(): Always free sdi->priv (devc).
authorUwe Hermann <redacted>
Tue, 11 Jul 2017 20:59:52 +0000 (22:59 +0200)
committerUwe Hermann <redacted>
Thu, 13 Jul 2017 09:59:11 +0000 (11:59 +0200)
commit8bf18daabbf3cb0fec6c178b4bc7f6283a314e45
treeb7ec5044158d8988c8c52d1dac46b76da4c66620
parent53279f13e4694fcf2aba314baade418941b0bc3e
sr_dev_clear(): Always free sdi->priv (devc).

Until now, clear_helper() callbacks for std_dev_clear_with_callback()
were expected to g_free(devc), but not all of them did that.

Have std_dev_clear_with_callback() unconditionally g_free(sdi->priv)
(i.e., devc), regardless of whether a clear_helper() callback was
provided or not. It was doing g_free(sdi->priv) when no callback
was provided already anyway.

This makes the individual drivers' clear_helper() implementations
shorter and prevents errors such as missing g_free(devc) calls.

This works, because all drivers either call std_dev_clear_with_callback()
directly, or indirectly via std_dev_clear().

This also allows us to remove some no-longer needed dev_clear()
and clear_helper() implementations that only did g_free(devc)
in favor of std_dev_clear().
14 files changed:
src/hardware/demo/api.c
src/hardware/dreamsourcelab-dslogic/api.c
src/hardware/ftdi-la/api.c
src/hardware/fx2lafw/api.c
src/hardware/hameg-hmo/api.c
src/hardware/hantek-6xxx/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/lecroy-xstream/api.c
src/hardware/rigol-ds/api.c
src/hardware/scpi-pps/api.c
src/hardware/sysclk-lwla/api.c
src/hardware/yokogawa-dlm/api.c
src/std.c