mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 18:18:03 +02:00
cli: cleanup of error handling in nmc_property_set_bytes()
This commit is contained in:
parent
d6db262597
commit
c09081dd2c
1 changed files with 5 additions and 12 deletions
|
|
@ -1913,9 +1913,8 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *value,
|
||||||
gs_free char *val_strip = NULL;
|
gs_free char *val_strip = NULL;
|
||||||
gs_free const char **strv = NULL;
|
gs_free const char **strv = NULL;
|
||||||
const char **iter;
|
const char **iter;
|
||||||
GBytes *bytes;
|
gs_unref_bytes GBytes *bytes = NULL;
|
||||||
GByteArray *array = NULL;
|
GByteArray *array;
|
||||||
gboolean success = TRUE;
|
|
||||||
|
|
||||||
nm_assert (!error || !*error);
|
nm_assert (!error || !*error);
|
||||||
|
|
||||||
|
|
@ -1937,8 +1936,7 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *value,
|
||||||
if (v == -1) {
|
if (v == -1) {
|
||||||
g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
|
g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
|
||||||
g_byte_array_free (array, TRUE);
|
g_byte_array_free (array, TRUE);
|
||||||
success = FALSE;
|
return FALSE;
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
v8 = v;
|
v8 = v;
|
||||||
g_byte_array_append (array, &v8, 1);
|
g_byte_array_append (array, &v8, 1);
|
||||||
|
|
@ -1946,13 +1944,8 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *value,
|
||||||
bytes = g_byte_array_free_to_bytes (array);
|
bytes = g_byte_array_free_to_bytes (array);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (success)
|
g_object_set (setting, prop, bytes, NULL);
|
||||||
g_object_set (setting, prop, bytes, NULL);
|
return TRUE;
|
||||||
|
|
||||||
if (bytes)
|
|
||||||
g_bytes_unref (bytes);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue