diff --git a/glib/gspawn.c b/glib/gspawn.c index 0ddd53249..d2ef460ab 100644 --- a/glib/gspawn.c +++ b/glib/gspawn.c @@ -1811,6 +1811,8 @@ do_posix_spawn (const gchar * const *argv, goto out_close_fds; duped_source_fds = g_new (gint, n_fds); + for (i = 0; i < n_fds; i++) + duped_source_fds[i] = -1; /* initialise in case dupfd_cloexec() fails below */ for (i = 0; i < n_fds; i++) { duped_source_fds[i] = dupfd_cloexec (source_fds[i], max_target_fd + 1);