debuggers.hg

changeset 22074:3a4c6c054b29

xl: free all data on exit from the domain monitor daemon.

[PATCH 01 of 16
libxl: autogenerate type definitions and destructor functions]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Thu Aug 19 14:40:24 2010 +0100 (2010-08-19)
parents 6bd04080ab99
children e486507c2d91
files tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/xl_cmdimpl.c	Wed Aug 18 18:06:10 2010 +0100
     1.2 +++ b/tools/libxl/xl_cmdimpl.c	Thu Aug 19 14:40:24 2010 +0100
     1.3 @@ -1557,9 +1557,11 @@ start:
     1.4                  if (ret) {
     1.5                      switch (handle_domain_death(&ctx, domid, &event, &d_config, &info)) {
     1.6                      case 2:
     1.7 -                        if (!preserve_domain(&ctx, domid, &event, &d_config, &info))
     1.8 +                        if (!preserve_domain(&ctx, domid, &event, &d_config, &info)) {
     1.9                              /* If we fail then exit leaving the old domain in place. */
    1.10 -                            exit(-1);
    1.11 +                            ret = -1;
    1.12 +                            goto out;
    1.13 +                        }
    1.14  
    1.15                          /* Otherwise fall through and restart. */
    1.16                      case 1:
    1.17 @@ -1577,7 +1579,8 @@ start:
    1.18                          goto start;
    1.19                      case 0:
    1.20                          LOG("Done. Exiting now");
    1.21 -                        exit(0);
    1.22 +                        ret = 0;
    1.23 +                        goto out;
    1.24                      }
    1.25                  }
    1.26                  break;
    1.27 @@ -1589,13 +1592,13 @@ start:
    1.28          libxl_free_event(&event);
    1.29      }
    1.30  
    1.31 -    close(logfile);
    1.32 -    exit(0);
    1.33 -
    1.34  error_out:
    1.35      if (domid)
    1.36          libxl_domain_destroy(&ctx, domid, 0);
    1.37 +
    1.38  out:
    1.39 +    if (logfile != 2)
    1.40 +        close(logfile);
    1.41  
    1.42      free_domain_config(&d_config);
    1.43