mirror of
https://github.com/TokTok/c-toxcore
synced 2026-10-22 21:52:43 +00:00
Does a realloc with a size of 0 if every port is invalid
This commit is contained in:
1 parent
532ace635a
commit
2df986f6b9
1 file changed
+3
-1
@@ -210,7 +210,9 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
|
||||
}
|
||||
|
||||
// the loop above skips invalid ports, so we adjust the allocated memory size
|
||||
*tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
|
||||
if ((*tcp_relay_port_count) * sizeof(uint16_t) > 0) {
|
||||
*tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
|
||||
}
|
||||
}
|
||||
|
||||
// Gets general config options
|
||||
|
||||
Reference in new issue
Block a user