mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 05:18:23 +02:00
all/trivial: add code comment about using alloca() inside a loop
lgtm.com warns about these uses. They are correct though. Maybe the code should not use alloca() simply to suppress the warning. Instead, add a comment pointing out that this is in fact correct.
This commit is contained in:
parent
f903d3b7b8
commit
d5e8d1382b
2 changed files with 5 additions and 3 deletions
|
|
@ -1863,10 +1863,11 @@ clear_secrets(const NMSettInfoSetting * sett_info,
|
|||
gs_free char *name_free = NULL;
|
||||
const char * name;
|
||||
|
||||
/* only stack-allocate (alloca) a few times. */
|
||||
if (j++ < 5)
|
||||
if (j++ < 5) {
|
||||
/* we use alloca() inside a loop here, but it is guarded to happen at most
|
||||
* a few times. */
|
||||
name = peers_psk_get_secret_name_a(peer->public_key, &name_free);
|
||||
else {
|
||||
} else {
|
||||
name_free = peers_psk_get_secret_name_dup(peer->public_key);
|
||||
name = name_free;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ _value_str_as_index_list(const char *value, gsize *out_len)
|
|||
str += good;
|
||||
} else {
|
||||
if (!str_cloned) {
|
||||
/* we use alloca() inside a loop here, but it is guarded to happen at most once. */
|
||||
str_cloned = TRUE;
|
||||
str = nm_strndup_a(200, str, strlen(str), &str_clone_free);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue