WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xl: Fix invalid return of internal ptrs v

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Fix invalid return of internal ptrs via libxl_poolid_to_name
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Aug 2010 02:15:35 -0700
Delivery-date: Fri, 13 Aug 2010 02:20:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User "Gianni Tedesco (3P)" <gianni.tedesco@xxxxxxxxxx>
# Date 1281528543 -3600
# Node ID 814eb6baf9799e3e72ac509cfb735357cf96595f
# Parent  8c60cc6aabd473e851c478e897184dc16e3f49c2
xl: Fix invalid return of internal ptrs via libxl_poolid_to_name
libxl_poolid_to_name has in-and-out-of-library callers. In library callers now 
use
_libxl_poolid_to_name() which participates in garbage collection and
out-of-library callers are fixed up to free() the domain name.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_internal.h |    1 +
 tools/libxl/libxl_utils.c    |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff -r 8c60cc6aabd4 -r 814eb6baf979 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Wed Aug 11 13:08:14 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Wed Aug 11 13:09:03 2010 +0100
@@ -228,6 +228,7 @@ char *libxl_abs_path(libxl_ctx *ctx, cha
 #define XL_LOG_ERROR   XTL_ERROR
 
 char *_libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid);
+char *_libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid);
 
 #endif
 
diff -r 8c60cc6aabd4 -r 814eb6baf979 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Wed Aug 11 13:08:14 2010 +0100
+++ b/tools/libxl/libxl_utils.c Wed Aug 11 13:09:03 2010 +0100
@@ -98,7 +98,14 @@ char *libxl_poolid_to_name(libxl_ctx *ct
         return "Pool-0";
     snprintf(path, sizeof(path), "/local/pool/%d/name", poolid);
     s = xs_read(ctx->xsh, XBT_NULL, path, &len);
-    libxl_ptr_add(ctx, s);
+    return s;
+}
+
+char *_libxl_poolid_to_name(libxl_ctx *ctx, uint32_t poolid)
+{
+    char *s = libxl_poolid_to_name(ctx, poolid);
+    if ( s )
+        libxl_ptr_add(ctx, s);
     return s;
 }
 
@@ -115,7 +122,7 @@ int libxl_name_to_poolid(libxl_ctx *ctx,
         return ERROR_NOMEM;
 
     for (i = 0; i < nb_pools; i++) {
-        poolname = libxl_poolid_to_name(ctx, poolinfo[i].poolid);
+        poolname = _libxl_poolid_to_name(ctx, poolinfo[i].poolid);
         if (!poolname)
             continue;
         if (strcmp(poolname, name) == 0) {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: Fix invalid return of internal ptrs via libxl_poolid_to_name, Xen patchbot-unstable <=