Skip to contentSkip to conversation

libxl: fix memory leak in libxl_name_to_poolid

PATCH Applied Juergen Gross 2 participants 2 messages Aug 5, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: fix memory leak in libxl_name_to_poolid

Hi,

attached patch is similar to cs 21908, just other function...

Juergen

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
Signed-off-by [email protected]
tools/libxl/libxl_utils.c +5 -2
diff -r 8992134dcfd0 tools/libxl/libxl_utils.c
@@ -101,6 +101,7 @@ int libxl_name_to_poolid(libxl_ctx *ctx,
     int i, nb_pools;
     char *poolname;
     libxl_poolinfo *poolinfo;
+    int ret = -1;
 
     poolinfo = libxl_list_pool(ctx, &nb_pools);
     if (!poolinfo)
@@ -112,10 +113,12 @@ int libxl_name_to_poolid(libxl_ctx *ctx,
             continue;
         if (strcmp(poolname, name) == 0) {
             *poolid = poolinfo[i].poolid;
-            return 0;
+            ret = 0;
+            break;
         }
     }
-    return -1;
+    free(poolinfo);
+    return ret;
 }
 
 int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 4 lines · Juergen Gross

Hi,

attached patch is similar to cs 21908, just other function...

applied, thanks