Skip to content

gkeyfile: Fix overwriting of GError

Jan Lübbe requested to merge jluebbe/glib:keyfile-escape-fix into main

When parsing a line of "key3=foo\i" in a keyfile, g_key_file_parse_value_as_string currently first sets the error to 'contains invalid escape' and later to 'contains escape character at end of line'.

This leaks the first GError and causes the following warning message: Error set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Key file contains escape character at end of line

Fix this by returning when an error is detected.

Merge request reports