]> sigrok.org Git - libsigrok.git/commitdiff
serial: Fix leak in serial_open.
authorpoljar (Damir Jelić) <redacted>
Tue, 19 Nov 2013 00:08:19 +0000 (01:08 +0100)
committerBert Vermeulen <redacted>
Tue, 19 Nov 2013 09:29:24 +0000 (10:29 +0100)
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.

hardware/common/serial.c

index 7dde05e00af35c70cd5513cda5a359a11aaf5656..05e6f3b4eb4768c4e244582e18d7944c092b49f4 100644 (file)
@@ -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: