debuggers.hg

changeset 21945:5b52397e10dc

xl: free the libxl context before exit

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Fri Jul 30 15:15:54 2010 +0100 (2010-07-30)
parents bb187c5a7fbc
children 7090637d61c5
files tools/libxl/xl.c
line diff
     1.1 --- a/tools/libxl/xl.c	Fri Jul 30 15:15:24 2010 +0100
     1.2 +++ b/tools/libxl/xl.c	Fri Jul 30 15:15:54 2010 +0100
     1.3 @@ -40,6 +40,7 @@ int main(int argc, char **argv)
     1.4      int opt = 0;
     1.5      char *cmd = 0;
     1.6      struct cmd_spec *cspec;
     1.7 +    int ret;
     1.8  
     1.9      while ((opt = getopt(argc, argv, "+v")) >= 0) {
    1.10          switch (opt) {
    1.11 @@ -72,12 +73,16 @@ int main(int argc, char **argv)
    1.12  
    1.13      cspec = cmdtable_lookup(cmd);
    1.14      if (cspec)
    1.15 -        return cspec->cmd_impl(argc, argv);
    1.16 +        ret = cspec->cmd_impl(argc, argv);
    1.17      else if (!strcmp(cmd, "help")) {
    1.18          help(argv[optind]);
    1.19 -        exit(0);
    1.20 +        ret = 0;
    1.21      } else {
    1.22          fprintf(stderr, "command not implemented\n");
    1.23 -        exit(1);
    1.24 +        ret = 1;
    1.25      }
    1.26 +
    1.27 +    libxl_ctx_free(&ctx);
    1.28 +
    1.29 +    return ret;
    1.30  }