lib/sysroot: Fix pointer going out of scope in unlock code
authorColin Walters <walters@verbum.org>
Wed, 4 Oct 2017 14:24:21 +0000 (10:24 -0400)
committerSimon McVittie <smcv@debian.org>
Thu, 26 Oct 2017 23:19:45 +0000 (00:19 +0100)
Fixes Coverity CID #1457317

Closes: #1249
Approved by: jlebon
Origin: upstream, 2017.13, commit:351ffdb9778436b193ba9d2fbeebe2358e55004f

Gbp-Pq: Topic 2017.13
Gbp-Pq: Name lib-sysroot-Fix-pointer-going-out-of-scope-in-unlock-code.patch

src/libostree/ostree-sysroot.c

index fe61a12e3013884c30d99613d9668f644a102a93..2ee5eb56eb0203a22539b8b7935ee0fb60ccef6b 100644 (file)
@@ -1698,6 +1698,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot     *self,
     return FALSE;
 
   const char *ovl_options = NULL;
+  static const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work";
   switch (unlocked_state)
     {
     case OSTREE_DEPLOYMENT_UNLOCKED_NONE:
@@ -1705,7 +1706,6 @@ ostree_sysroot_deployment_unlock (OstreeSysroot     *self,
       break;
     case OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX:
       {
-        const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work";
         /* Create the overlayfs directories in the deployment root
          * directly for hotfixes.  The ostree-prepare-root.c helper
          * is also set up to detect and mount these.