From e31f2c6b8b8f2b7e554df911cc9a3482b99632b4 Mon Sep 17 00:00:00 2001 From: Boris Gjenero Date: Fri, 5 Dec 2014 18:38:43 +0100 Subject: [PATCH] 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. --- serialport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/serialport.c b/serialport.c index 4f42740..2ec2c2f 100644 --- a/serialport.c +++ b/serialport.c @@ -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;