[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xl: free common_domname on exit



On Wed, Jun 12, 2013 at 2:35 PM, Ian Campbell <ian.campbell@xxxxxxxxxx> wrote:
> The split between xl.c and xl_cmdimpl.c made this a bit odd, I chose to add a
> destructor to xl_cmdimpl.c which is called from xl.c instead of making the
> variable non-static since that seems like a nicer encapsulation.
>
> ==5915== 6 bytes in 1 blocks are still reachable in loss record 1 of 1
> ==5915==    at 0x4025755: malloc (vg_replace_malloc.c:291)
> ==5915==    by 0x424FDF3: read_message (xs.c:1145)
> ==5915==    by 0x425017E: xs_talkv (xs.c:428)
> ==5915==    by 0x4250445: xs_single (xs.c:546)
> ==5915==    by 0x42504CE: xs_read (xs.c:592)
> ==5915==    by 0x4074E2C: libxl_domid_to_name (libxl_utils.c:54)
> ==5915==    by 0x804E3F2: find_domain (xl_cmdimpl.c:186)
> ==5915==    by 0x8055B7E: main_destroy (xl_cmdimpl.c:3942)
> ==5915==    by 0x804DD60: main (xl.c:371)
>
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: George.Dunlap@xxxxxxxxxx
> ---
>  tools/libxl/xl.c         |    2 ++
>  tools/libxl/xl.h         |    2 ++
>  tools/libxl/xl_cmdimpl.c |    7 +++++--
>  3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
> index 0f3acb9..3201180 100644
> --- a/tools/libxl/xl.c
> +++ b/tools/libxl/xl.c
> @@ -291,6 +291,8 @@ static void xl_ctx_free(void)
>          free(default_gatewaydev);
>          default_gatewaydev = NULL;
>      }
> +
> +    xl_cmdimpl_atexit();
>  }
>
>  int main(int argc, char **argv)
> diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h
> index 771b4af..5ae8d11 100644
> --- a/tools/libxl/xl.h
> +++ b/tools/libxl/xl.h
> @@ -113,6 +113,8 @@ extern int cmdtable_len;
>  /* Look up a command in the table, allowing unambiguous truncation */
>  struct cmd_spec *cmdtable_lookup(const char *s);
>
> +extern void xl_cmdimpl_atexit(void);
> +
>  extern libxl_ctx *ctx;
>  extern xentoollog_logger_stdiostream *logger;
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index c1a969b..325b257 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -68,7 +68,7 @@ libxl_ctx *ctx;
>  xlchild children[child_max];
>
>  #define INVALID_DOMID ~0
> -static const char *common_domname;
> +static char *common_domname = NULL;

Why is "const" being removed?

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.