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:
Philip Withnall 2016-03-21 12:35:25 +00:00
parent 7401dc1b0c
commit 58f56b2460

View File

@ -970,6 +970,7 @@ g_key_file_load_from_dirs (GKeyFile *key_file,
while (*data_dirs != NULL && !found_file)
{
g_free (output_path);
output_path = NULL;
fd = find_file_in_data_dirs (file, data_dirs, &output_path,
&key_file_error);