From: Boris Gjenero Date: Fri, 5 Dec 2014 17:38:43 +0000 (+0100) Subject: Fix free() of uninitialized pointer. X-Git-Tag: libserialport-0.1.1~88 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e31f2c6b8b8f2b7e554df911cc9a3482b99632b4;p=libserialport.git 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. --- 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;