mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 14:10:23 +01:00
libnmt-newt: fix leak in nmt_newt_button_build_component()
Found by Coverity:
Error: RESOURCE_LEAK (CWE-772): [#def274] [important]
NetworkManager-1.31.3/src/libnmt-newt/nmt-newt-button.c:118: alloc_fn: Storage is returned from allocation function "g_strdup_printf".
NetworkManager-1.31.3/src/libnmt-newt/nmt-newt-button.c:118: var_assign: Assigning: "label" = storage returned from "g_strdup_printf(" <%s>", priv->label)".
NetworkManager-1.31.3/src/libnmt-newt/nmt-newt-button.c:119: noescape: Resource "label" is not freed or pointed-to in "nmt_newt_locale_from_utf8".
NetworkManager-1.31.3/src/libnmt-newt/nmt-newt-button.c:125: leaked_storage: Variable "label" going out of scope leaks the storage it points to.
# 123| }
# 124|
# 125|-> return co;
# 126| }
# 127|
Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
This commit is contained in:
parent
2c628e4762
commit
853f411567
1 changed files with 2 additions and 1 deletions
|
|
@ -108,7 +108,8 @@ nmt_newt_button_build_component(NmtNewtComponent *component, gboolean sensitive)
|
|||
{
|
||||
NmtNewtButtonPrivate *priv = NMT_NEWT_BUTTON_GET_PRIVATE(component);
|
||||
newtComponent co;
|
||||
char * label = NULL, *label_lc;
|
||||
gs_free char * label = NULL;
|
||||
char * label_lc;
|
||||
|
||||
if (sensitive) {
|
||||
label_lc = nmt_newt_locale_from_utf8(priv->label);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue