1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Fix malloc size (Win32)

This commit is contained in:
silverbuddy 2014-03-21 21:49:22 +04:00
parent 904ac164bf
commit e48f0ece0f

View File

@ -626,7 +626,7 @@ enum sp_return sp_open(struct sp_port *port, enum sp_mode flags)
COMSTAT status; COMSTAT status;
/* Prefix port name with '\\.\' to work with ports above COM9. */ /* 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"); RETURN_ERROR(SP_ERR_MEM, "Escaped port name malloc failed");
sprintf(escaped_port_name, "\\\\.\\%s", port->name); sprintf(escaped_port_name, "\\\\.\\%s", port->name);