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)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 4 Oct 2017 14:56:31 +0000 (14:56 +0000)
Fixes Coverity CID #1457317

Closes: #1249
Approved by: jlebon

src/libostree/ostree-sysroot.c

index b49b4277ea44e62a783c42b77fecef6430b8b9a4..984e16d5eb7f9522b1b1b10f8e8a61bfc2e388d1 100644 (file)
@@ -1703,6 +1703,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:
@@ -1710,7 +1711,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.