]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
virNetDevBandwidthUnplug: Don't leak @cmd
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 3 Jul 2013 07:43:14 +0000 (09:43 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 3 Jul 2013 07:43:14 +0000 (09:43 +0200)
When removing a TAP device, the associated bandwidth settings are
removed. Currently, the /sbin/tc is used for that. It is spawned
several times. Moreover, we use the same @cmd variable to
construct the command and its arguments. That means we need to
virCommandFree(cmd); prior to each virCommandNew(TC); which
wasn't done.

src/util/virnetdevbandwidth.c

index ccc1449d7695253845e1f138ffebf0500a448eca..74e6c8cbc07c7fc5c80a69593d5b5125282f0a88 100644 (file)
@@ -519,6 +519,7 @@ virNetDevBandwidthUnplug(const char *brname,
     if (virCommandRun(cmd, &cmd_ret) < 0)
         goto cleanup;
 
+    virCommandFree(cmd);
     cmd = virCommandNew(TC);
     virCommandAddArgList(cmd, "class", "del", "dev", brname,
                          "classid", class_id, NULL);