mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Fix free() of uninitialized pointer.
Explicitly set port->usb_path to NULL, otherwise a free(port->usb_path) can happen where port->usb_path is uninitialized. This closes bug #512.
This commit is contained in:
parent
b328a48b0f
commit
e31f2c6b8b
@ -85,6 +85,7 @@ SP_API enum sp_return sp_get_port_by_name(const char *portname, struct sp_port *
|
|||||||
memcpy(port->name, portname, len);
|
memcpy(port->name, portname, len);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
port->usb_path = NULL;
|
||||||
port->hdl = INVALID_HANDLE_VALUE;
|
port->hdl = INVALID_HANDLE_VALUE;
|
||||||
#else
|
#else
|
||||||
port->fd = -1;
|
port->fd = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user