]> sigrok.org Git - libserialport.git/commitdiff
Fix free() of uninitialized pointer.
authorBoris Gjenero <redacted>
Fri, 5 Dec 2014 17:38:43 +0000 (18:38 +0100)
committerUwe Hermann <redacted>
Fri, 5 Dec 2014 17:42:43 +0000 (18:42 +0100)
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.

serialport.c

index 4f42740a2388fe398034f13722e3aaaa9f4f2121..2ec2c2f19225f9a526f6438f7b6144a5a6270351 100644 (file)
@@ -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);
 
 #ifdef _WIN32
+       port->usb_path = NULL;
        port->hdl = INVALID_HANDLE_VALUE;
 #else
        port->fd = -1;