kernel-device-generic: Fix ptr_array_add_sysfs_attribute_link_basename
A pointer can not be used anymore after its ownership has been transfered using the g_steal_pointer function (pointer is nullified). In this function, g_steal_pointer() is used when inserting 'value' inside the array but can also be subsequently used when dumping 'value' to 'out_value' via g_strdup(). Fix that with simple reordering. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
This commit is contained in:

committed by
Aleksander Morgado

parent
b91bf1e3a6
commit
9e5e699227
@@ -238,10 +238,12 @@ ptr_array_add_sysfs_attribute_link_basename (GPtrArray *array,
|
||||
|
||||
g_assert (array && sysfs_path && attribute);
|
||||
value = read_sysfs_attribute_link_basename (sysfs_path, attribute);
|
||||
if (value && !g_ptr_array_find_with_equal_func (array, value, g_str_equal, NULL))
|
||||
g_ptr_array_add (array, g_steal_pointer (&value));
|
||||
|
||||
if (out_value)
|
||||
*out_value = g_strdup (value);
|
||||
if (value && !g_ptr_array_find_with_equal_func (array, value, g_str_equal, NULL))
|
||||
g_ptr_array_add (array, g_steal_pointer (&value));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user