mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-03 22:58:10 +02:00
cli: avoid coverity warning in do_connection_down()
Error: USE_AFTER_FREE (CWE-416): [#def729] [important]
NetworkManager-1.31.90/src/nmcli/connections.c:3288: freed_arg: "connection_cb_info_finish" frees "info".
NetworkManager-1.31.90/src/nmcli/connections.c:3287: pass_freed_arg: Passing freed pointer "info" as an argument to "g_signal_handlers_disconnect_matched".
# 3285|
# 3286| if (info) {
# 3287|-> g_signal_handlers_disconnect_by_func(active, down_active_connection_state_cb, info);
# 3288| connection_cb_info_finish(info, active);
# 3289| }
This commit is contained in:
parent
7825609f1f
commit
627503ad86
1 changed files with 6 additions and 0 deletions
|
|
@ -3284,7 +3284,13 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons
|
|||
g_clear_error(&error);
|
||||
|
||||
if (info) {
|
||||
/* coverity thinks that info might be freed already while we still iterate
|
||||
* the loop. But it cannot, because connection_cb_info_finish() only does some
|
||||
* kind of ref-counting that ensures info stays alive long enough. */
|
||||
|
||||
/* coverity[pass_freed_arg] */
|
||||
g_signal_handlers_disconnect_by_func(active, down_active_connection_state_cb, info);
|
||||
|
||||
connection_cb_info_finish(info, active);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue