From: silverbuddy Date: Fri, 21 Mar 2014 17:49:22 +0000 (+0400) Subject: Fix malloc size (Win32) X-Git-Tag: libserialport-0.1.0~7^2 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e48f0ece0fc4164de01ab4fa11a1c2452ea39466;p=libserialport.git Fix malloc size (Win32) --- diff --git a/serialport.c b/serialport.c index 86c35f8..2580206 100644 --- a/serialport.c +++ b/serialport.c @@ -626,7 +626,7 @@ enum sp_return sp_open(struct sp_port *port, enum sp_mode flags) COMSTAT status; /* Prefix port name with '\\.\' to work with ports above COM9. */ - if (!(escaped_port_name = malloc(strlen(port->name + 5)))) + if (!(escaped_port_name = malloc(strlen(port->name) + 5))) RETURN_ERROR(SP_ERR_MEM, "Escaped port name malloc failed"); sprintf(escaped_port_name, "\\\\.\\%s", port->name);