debuggers.hg

changeset 21976:baaa4b9d385f

libxl: fix memory leak in libxl_name_to_poolid

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Juergen Gross <juergen.gross@ts.fujitsu.com>
date Thu Aug 05 11:33:13 2010 +0100 (2010-08-05)
parents d627f6b581b4
children 6b28b2dac7dd
files tools/libxl/libxl_utils.c
line diff
     1.1 --- a/tools/libxl/libxl_utils.c	Wed Aug 04 18:08:39 2010 +0100
     1.2 +++ b/tools/libxl/libxl_utils.c	Thu Aug 05 11:33:13 2010 +0100
     1.3 @@ -101,6 +101,7 @@ int libxl_name_to_poolid(libxl_ctx *ctx,
     1.4      int i, nb_pools;
     1.5      char *poolname;
     1.6      libxl_poolinfo *poolinfo;
     1.7 +    int ret = -1;
     1.8  
     1.9      poolinfo = libxl_list_pool(ctx, &nb_pools);
    1.10      if (!poolinfo)
    1.11 @@ -112,10 +113,12 @@ int libxl_name_to_poolid(libxl_ctx *ctx,
    1.12              continue;
    1.13          if (strcmp(poolname, name) == 0) {
    1.14              *poolid = poolinfo[i].poolid;
    1.15 -            return 0;
    1.16 +            ret = 0;
    1.17 +            break;
    1.18          }
    1.19      }
    1.20 -    return -1;
    1.21 +    free(poolinfo);
    1.22 +    return ret;
    1.23  }
    1.24  
    1.25  int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid)