mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
gkeyfile: Clear a variable after freeing it
find_file_in_data_dirs() doesn’t actually clear output_path to NULL on failure, so this prevents a use-after-free on that (fd == -1) error path. Spotted by Coverity (CID: #1352981).
This commit is contained in:
parent
7401dc1b0c
commit
58f56b2460
@ -970,6 +970,7 @@ g_key_file_load_from_dirs (GKeyFile *key_file,
|
|||||||
while (*data_dirs != NULL && !found_file)
|
while (*data_dirs != NULL && !found_file)
|
||||||
{
|
{
|
||||||
g_free (output_path);
|
g_free (output_path);
|
||||||
|
output_path = NULL;
|
||||||
|
|
||||||
fd = find_file_in_data_dirs (file, data_dirs, &output_path,
|
fd = find_file_in_data_dirs (file, data_dirs, &output_path,
|
||||||
&key_file_error);
|
&key_file_error);
|
||||||
|
Loading…
Reference in New Issue
Block a user