From c9219181c4c045ff27122841fa24694ba86edee4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 4 Oct 2014 15:08:49 -0400 Subject: [PATCH] status: Consistently use malloc'd() memory for status This crashed when "atomic status" on an origin that didn't have a refspec, which happened via my new atomic-pkglayer demo script. --- src/rpmostree-builtin-status.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpmostree-builtin-status.c b/src/rpmostree-builtin-status.c index 68bdd245..5c740316 100644 --- a/src/rpmostree-builtin-status.c +++ b/src/rpmostree-builtin-status.c @@ -98,7 +98,7 @@ rpmostree_builtin_status (int argc, { origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); if (!origin_refspec) - origin_refspec = ""; + origin_refspec = g_strdup (""); } max_refspec_len = MAX (max_refspec_len, strlen (origin_refspec)); } @@ -145,12 +145,12 @@ rpmostree_builtin_status (int argc, /* get origin refspec */ origin = ostree_deployment_get_origin (deployment); if (!origin) - origin_refspec = "none"; + origin_refspec = g_strdup ("none"); else { origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); if (!origin_refspec) - origin_refspec = ""; + origin_refspec = g_strdup (""); } /* truncate checksum */