summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/tox-bootstrapd.c
diff options
context:
space:
mode:
authorSean Qureshi <sean@tox.im>2014-10-10 18:23:23 -0700
committerSean Qureshi <sean@tox.im>2014-10-10 18:23:23 -0700
commit2df986f6b951aee49f403ff076f213213ce873eb (patch)
tree4ebf24d307bb4912b00b93c680a8a54b6af88115 /other/bootstrap_daemon/tox-bootstrapd.c
parent532ace635a095d4613e37f880b573ad126671aef (diff)
Does a realloc with a size of 0 if every port is invalid
Diffstat (limited to 'other/bootstrap_daemon/tox-bootstrapd.c')
-rw-r--r--other/bootstrap_daemon/tox-bootstrapd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c
index 0848cd17..a0f93bb3 100644
--- a/other/bootstrap_daemon/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/tox-bootstrapd.c
@@ -210,7 +210,9 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
210 } 210 }
211 211
212 // the loop above skips invalid ports, so we adjust the allocated memory size 212 // the loop above skips invalid ports, so we adjust the allocated memory size
213 *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); 213 if ((*tcp_relay_port_count) * sizeof(uint16_t) > 0) {
214 *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t));
215 }
214} 216}
215 217
216// Gets general config options 218// Gets general config options