mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 21:20:10 +01:00
tests: don't use alloca() in tests
The only purpose of using alloca() to avoid the overhead of heap-allocation and possible save a line in source code for managing/freeing the heap allocation. For tests we don't care about performance, and (in this case) the code does not get any shorter. Avoid alloca() in tests, because alloca() is something to search for when reviewing code for stack overflows. No need to have such false positives show up in tests.
This commit is contained in:
parent
694533f529
commit
e18ff51d4f
1 changed files with 2 additions and 2 deletions
|
|
@ -352,13 +352,13 @@ _match_connection (GSList *connections,
|
|||
gint64 default_v4_metric,
|
||||
gint64 default_v6_metric)
|
||||
{
|
||||
NMConnection **list;
|
||||
gs_free NMConnection **list = NULL;
|
||||
guint i, len;
|
||||
|
||||
len = g_slist_length (connections);
|
||||
g_assert (len < 10);
|
||||
|
||||
list = g_alloca ((len + 1) * sizeof (NMConnection *));
|
||||
list = g_malloc ((len + 1) * sizeof (NMConnection *));
|
||||
for (i = 0; i < len; i++, connections = connections->next) {
|
||||
g_assert (connections);
|
||||
g_assert (connections->data);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue