mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-05 18:10:36 +01:00
libnm: use nm_auto_unref_tc_action cleanup macro in nm_utils_tc_action_from_str()
This commit is contained in:
parent
3cd56e92d4
commit
90f5d9114f
1 changed files with 5 additions and 8 deletions
|
|
@ -2587,9 +2587,9 @@ nm_utils_tc_action_to_str(NMTCAction *action, GError **error)
|
|||
NMTCAction *
|
||||
nm_utils_tc_action_from_str(const char *str, GError **error)
|
||||
{
|
||||
const char * kind = NULL;
|
||||
const char * rest = NULL;
|
||||
NMTCAction * action = NULL;
|
||||
const char * kind = NULL;
|
||||
const char * rest = NULL;
|
||||
nm_auto_unref_tc_action NMTCAction *action = NULL;
|
||||
gs_unref_hashtable GHashTable *ht = NULL;
|
||||
gs_unref_hashtable GHashTable * options = NULL;
|
||||
GVariant * variant;
|
||||
|
|
@ -2631,23 +2631,20 @@ nm_utils_tc_action_from_str(const char *str, GError **error)
|
|||
gpointer key, value;
|
||||
|
||||
if (!attrs) {
|
||||
nm_tc_action_unref(action);
|
||||
g_set_error(error, 1, 0, _("unsupported action option: '%s'."), rest);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
options = nm_utils_parse_variant_attributes(rest, ' ', ' ', FALSE, attrs, error);
|
||||
if (!options) {
|
||||
nm_tc_action_unref(action);
|
||||
if (!options)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_hash_table_iter_init(&iter, options);
|
||||
while (g_hash_table_iter_next(&iter, &key, &value))
|
||||
nm_tc_action_set_attribute(action, key, g_variant_ref_sink(value));
|
||||
}
|
||||
|
||||
return action;
|
||||
return g_steal_pointer(&action);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue