mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 00:12:19 +01:00 
			
		
		
		
	gfilenamecompleter: Fix g_object_unref() of undefined value
If the first `goto out` is taken, `file` has not yet been initialised, but `g_clear_object (&file)` is called on it, and things get unhappy. Fix that by following standard convention and initialising ‘autoptr’-like variables at declaration time. Spotted by scan-build in https://gitlab.gnome.org/GNOME/glib/-/jobs/5321883. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
		| @@ -342,7 +342,7 @@ init_completion (GFilenameCompleter *completer, | |||||||
| 		 char **basename_out) | 		 char **basename_out) | ||||||
| { | { | ||||||
|   gboolean should_escape; |   gboolean should_escape; | ||||||
|   GFile *file, *parent; |   GFile *file = NULL, *parent = NULL; | ||||||
|   char *basename; |   char *basename; | ||||||
|   char *t; |   char *t; | ||||||
|   size_t len; |   size_t len; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user