Skip to content
This repository was archived by the owner on Jul 23, 2020. It is now read-only.

Commit c7d00d2

Browse files
committed
buffer-utils: Fix possible crash handling compasses
The generic_name is supposed to be an allocated string. As we were passing it a static string, it might have crashed later on.
1 parent 80126b5 commit c7d00d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/iio-buffer-utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ build_channel_array (const char *device_dir,
257257
current->name = g_strndup (name, strlen(name) - strlen("_en"));
258258
current->generic_name = iioutils_break_up_name (current->name);
259259
if (g_strcmp0(current->generic_name, "in_rot_from_north_magnetic_tilt") == 0) {
260-
current->generic_name = "in_rot";
260+
current->generic_name = g_strdup ("in_rot");
261261
}
262262

263263
index_name = g_strdup_printf ("%s_index", current->name);

0 commit comments

Comments
 (0)