mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 17:08:53 +02: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>
(cherry picked from commit a41d1681be
)
Co-authored-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -342,7 +342,7 @@ init_completion (GFilenameCompleter *completer,
|
||||
char **basename_out)
|
||||
{
|
||||
gboolean should_escape;
|
||||
GFile *file, *parent;
|
||||
GFile *file = NULL, *parent = NULL;
|
||||
char *basename;
|
||||
char *t;
|
||||
size_t len;
|
||||
|
Reference in New Issue
Block a user