]> xenbits.xensource.com Git - libvirt.git/commitdiff
LXC: don't free tty before using it in lxcContainerSetupDevices
authorGao feng <gaofeng@cn.fujitsu.com>
Tue, 29 Oct 2013 06:19:35 +0000 (14:19 +0800)
committerJán Tomko <jtomko@redhat.com>
Tue, 29 Oct 2013 14:44:56 +0000 (15:44 +0100)
Introduced by commit 0f31f7b.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/lxc/lxc_container.c

index 1ec59d5c6ef2cbe362a0e2499882c9d3a6a46967..255c7114d22b4865e8485fc2622c72fc5d192b98 100644 (file)
@@ -1042,10 +1042,10 @@ static int lxcContainerSetupDevices(char **ttyPaths, size_t nttyPaths)
         if (virAsprintf(&tty, "/dev/tty%zu", i+1) < 0)
             return -1;
         if (symlink(ttyPaths[i], tty) < 0) {
-            VIR_FREE(tty);
             virReportSystemError(errno,
                                  _("Failed to symlink %s to %s"),
                                  ttyPaths[i], tty);
+            VIR_FREE(tty);
             return -1;
         }
         VIR_FREE(tty);