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.
This commit is contained in:
poljar (Damir Jelić) 2013-11-19 01:08:19 +01:00 committed by Bert Vermeulen
parent 90c7f4e92d
commit 066d42b1c8
1 changed files with 1 additions and 0 deletions

View 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: