While parsing the labels file, a label per line is expected.
g_strsplit(file_contents, '\n', -1) is used to parse the file and
returns the label as a string vector.
The last '\n' in the file introduces an additional empty element, as the
delimiter involves 2 elements.
Hence, the patch is removing the last trailing '\n' to avoid this
additional dummy element in the labels list.
Signed-off-by: Xavier Roumegue <xavier.roumegue@nxp.com>
g_clear_error (&err);
return;
}
+ len = strlen (contents);
+
+ if (contents[len - 1] == '\n')
+ contents[len - 1] = '\0';
_labels = g_strsplit (contents, "\n", -1);
l->total_labels = g_strv_length (_labels);