MT#61856 media_socket: don't exhaust stack

With big arrays of INTs, even though the variable type
isn't quite heavy, if the pool is for example around
10000...65535 (just because someone needs so many)
this loads the stack quite sensible. Just use heap for
these calculations.

Change-Id: I2ef838a1cb067e6986ba6a6b1c60945d437fabb0
pull/2138/head
Donat Zenichev 2 weeks ago
parent 114b5ce7da
commit 3cf8a12ab8

@ -829,7 +829,7 @@ static void __append_free_ports_to_int(struct intf_spec *spec) {
return;
}
int port_values[ports_amount];
unsigned int *port_values = g_new(unsigned int, ports_amount);
/* create an array to store the initial values within the range */
for (int i = 0; i < ports_amount; i++)
@ -854,6 +854,8 @@ static void __append_free_ports_to_int(struct intf_spec *spec) {
port_values[j] = port_values[count - 1];
count--;
}
g_free(port_values);
}
// called during single-threaded startup only
static void __add_intf_rr_1(struct logical_intf *lif, str *name_base, sockfamily_t *fam) {

Loading…
Cancel
Save