From: poljar (Damir Jelić) Date: Tue, 19 Nov 2013 00:08:19 +0000 (+0100) Subject: serial: Fix leak in serial_open. X-Git-Tag: libsigrok-0.3.0~553 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=066d42b1c803e3b78b7d34df1f1516f729f81085;p=libsigrok.git serial: Fix leak in serial_open. A new sp_port is created every time we call serial_open (sp_get_port_by_name implicitly creates one for us), so free it every time we call serial_close. --- diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 7dde05e0..05e6f3b4 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -110,6 +110,7 @@ SR_PRIV int serial_close(struct sr_serial_dev_inst *serial) sr_spew("Closing serial port %s (fd %d).", serial->port, serial->fd); ret = sp_close(serial->data); + sp_free_port(serial->data); switch (ret) { case SP_ERR_ARG: