[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: introduce libxl_vcpuinfo_list_free


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 29 May 2012 16:44:10 +0000
  • Delivery-date: Tue, 29 May 2012 16:44:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Dario Faggioli <raistlin@xxxxxxxx>
# Date 1338287796 -3600
# Node ID 52ffce7a036e88a09207cf0e372f8c95f0331b53
# Parent  a81a4c3b5cfd669477f865f632f928c881acac0e
libxl: introduce libxl_vcpuinfo_list_free

And fix a leak due to it being missing.

Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r a81a4c3b5cfd -r 52ffce7a036e tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue May 29 11:12:45 2012 +0100
+++ b/tools/libxl/libxl.h       Tue May 29 11:36:36 2012 +0100
@@ -765,6 +765,7 @@ libxl_cputopology *libxl_get_cpu_topolog
 void libxl_cputopology_list_free(libxl_cputopology *, int nr);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
+void libxl_vcpuinfo_list_free(libxl_vcpuinfo *, int nr);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
                            libxl_cpumap *cpumap);
 int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid,
diff -r a81a4c3b5cfd -r 52ffce7a036e tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Tue May 29 11:12:45 2012 +0100
+++ b/tools/libxl/libxl_utils.c Tue May 29 11:36:36 2012 +0100
@@ -558,6 +558,14 @@ void libxl_cputopology_list_free(libxl_c
     free(list);
 }
 
+void libxl_vcpuinfo_list_free(libxl_vcpuinfo *list, int nr)
+{
+    int i;
+    for (i = 0; i < nr; i++)
+        libxl_vcpuinfo_dispose(&list[i]);
+    free(list);
+}
+
 int libxl__sendmsg_fds(libxl__gc *gc, int carrier,
                        const void *data, size_t datalen,
                        int nfds, const int fds[], const char *what) {
diff -r a81a4c3b5cfd -r 52ffce7a036e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue May 29 11:12:45 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue May 29 11:36:36 2012 +0100
@@ -3979,10 +3979,9 @@ static void print_domain_vcpuinfo(uint32
 
     for (i = 0; i < nb_vcpu; i++) {
         print_vcpuinfo(domid, &vcpuinfo[i], nr_cpus);
-        libxl_vcpuinfo_dispose(&vcpuinfo[i]);
-    }
-
-    free(vcpuinfo);
+    }
+
+    libxl_vcpuinfo_list_free(vcpuinfo, nb_vcpu);
 }
 
 static void vcpulist(int argc, char **argv)
@@ -4070,11 +4069,14 @@ static void vcpupin(const char *d, const
             fprintf(stderr, "libxl_list_vcpu failed.\n");
             goto vcpupin_out1;
         }
-        for (; nb_vcpu > 0; --nb_vcpu, ++vcpuinfo) {
-            if (libxl_set_vcpuaffinity(ctx, domid, vcpuinfo->vcpuid, &cpumap) 
== -1) {
-                fprintf(stderr, "libxl_set_vcpuaffinity failed on vcpu 
`%u'.\n", vcpuinfo->vcpuid);
+        for (i = 0; i < nb_vcpu; i++) {
+            if (libxl_set_vcpuaffinity(ctx, domid, vcpuinfo[i].vcpuid,
+                                       &cpumap) == -1) {
+                fprintf(stderr, "libxl_set_vcpuaffinity failed"
+                                " on vcpu `%u'.\n", vcpuinfo[i].vcpuid);
             }
         }
+        libxl_vcpuinfo_list_free(vcpuinfo, nb_vcpu);
     }
   vcpupin_out1:
     libxl_cpumap_dispose(&cpumap);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.