From: Gerhard Sittig Date: Fri, 18 Aug 2017 18:07:23 +0000 (+0200) Subject: lcr/es51919: clean but don't free dev context in cleanup callback X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=12788e7e40b53732bc05904b34faabda39b47f02;p=libsigrok.git lcr/es51919: clean but don't free dev context in cleanup callback The es51919_serial_clean() routine is called by std_dev_clear_with_callback(). Common code unconditionally frees the 'priv' part. The cleanup callback only shall release descending resources which are local to the callee and opaque to the caller. This fixes a double free error. Tested with PeakTech 2170. $ sigrok-cli -d peaktech-2170:conn=/dev/ttyUSB0 --show --- diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index 9030a4ba..715c25cd 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -726,7 +726,6 @@ SR_PRIV void es51919_serial_clean(void *priv) return; dev_buffer_destroy(devc->buf); - g_free(devc); } SR_PRIV struct sr_dev_inst *es51919_serial_scan(GSList *options,