libsigrok/hardware/chronovu-la8
Alexandru Gagniuc 4f9bf9a202 chronovu-la8: Fix memory leak in hw_scan
Hardware scanning creates an ftdi_context before attempting to locate devices
based on PID/VID. If no devices are detected, execution jumps to cleanup. The
context is freed with free(), instead of ftdi_free().

We cannot assume that the libftdi context is stored in a contiguous memory
region, and thus cannot use a simple free. Case in point, this situation is
identified by valgrind as a "definitely lost" memory leak.

Use ftdi_free() instead of a simple free() in hw_scan(). Valgrind no longer
complains about a memory leak in this area.

clear_instances() does not need any modification, as it correctly uses
ftdi_free().

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2012-12-18 02:08:36 +01:00
..
Makefile.am la8: Rename driver.[ch] to protocol.[ch]. 2012-10-27 22:36:34 +02:00
api.c chronovu-la8: Fix memory leak in hw_scan 2012-12-18 02:08:36 +01:00
protocol.c la8: Rename driver.[ch] to protocol.[ch]. 2012-10-27 22:36:34 +02:00
protocol.h la8: Rename driver.[ch] to protocol.[ch]. 2012-10-27 22:36:34 +02:00