]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc_controller: Don't leak @name
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 7 Jan 2014 14:42:44 +0000 (15:42 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 7 Jan 2014 15:21:03 +0000 (16:21 +0100)
The @name variable is VIR_STRDUP()-ed into, but never freed. In fact,
there's no need to duplicate a command line argument since all places
where @name is used expect const char.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/lxc/lxc_controller.c

index c013147f7ae75cb376648e45a3bec3ec89ce052e..1b43bd263805ce8fcea067248807b1c939a4845b 100644 (file)
@@ -2249,7 +2249,7 @@ int main(int argc, char *argv[])
 {
     pid_t pid;
     int rc = -1;
-    char *name = NULL;
+    const char *name = NULL;
     size_t nveths = 0;
     char **veths = NULL;
     int handshakeFd = -1;
@@ -2300,8 +2300,7 @@ int main(int argc, char *argv[])
             break;
 
         case 'n':
-            if (VIR_STRDUP(name, optarg) < 0)
-                goto cleanup;
+            name = optarg;
             break;
 
         case 'v':