diff --git a/src/ostree/ostree-trivial-httpd.c b/src/ostree/ostree-trivial-httpd.c index 72de8d79..d6f0c4d4 100644 --- a/src/ostree/ostree-trivial-httpd.c +++ b/src/ostree/ostree-trivial-httpd.c @@ -520,7 +520,7 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) } else { - g_autoptr(GFile) log_file; + g_autoptr(GFile) log_file = NULL; GFileOutputStream* log_stream; log_file = g_file_new_for_path (opt_log); @@ -601,9 +601,12 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error) if (setsid () < 0) err (1, "setsid"); /* Daemonising: close stdout/stderr so $() et al work on us */ - freopen("/dev/null", "r", stdin); - freopen("/dev/null", "w", stdout); - freopen("/dev/null", "w", stderr); + if (freopen("/dev/null", "r", stdin) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stdout) == NULL) + err (1, "freopen"); + if (freopen("/dev/null", "w", stderr) == NULL) + err (1, "freopen"); } else { diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c index 4760e532..0d8290a8 100644 --- a/src/ostree/ot-builtin-admin.c +++ b/src/ostree/ot-builtin-admin.c @@ -125,7 +125,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError * if (!subcommand->name) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = ostree_admin_option_context_new_with_commands (); diff --git a/src/ostree/ot-builtin-remote.c b/src/ostree/ot-builtin-remote.c index 4f01cac2..f0667a42 100644 --- a/src/ostree/ot-builtin-remote.c +++ b/src/ostree/ot-builtin-remote.c @@ -114,7 +114,7 @@ ostree_builtin_remote (int argc, char **argv, GCancellable *cancellable, GError if (!subcommand->name) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = remote_option_context_new_with_commands (); diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c index c6a2b6dd..3484b18e 100644 --- a/src/ostree/ot-main.c +++ b/src/ostree/ot-main.c @@ -171,7 +171,7 @@ ostree_run (int argc, if (!command->fn) { g_autoptr(GOptionContext) context = NULL; - g_autofree char *help; + g_autofree char *help = NULL; context = ostree_option_context_new_with_commands (commands);