diff mbox

[1/2] xl: free event in DOMAIN_RESTART_RENAME error path

Message ID 20170202154637.1478-2-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Feb. 2, 2017, 3:46 p.m. UTC
Otherwise it is leaked. Found by code inspection.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Fatih Acar <fatih.acar@gandi.net>

Backport candidate.
---
 tools/libxl/xl_cmdimpl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Wei Liu Feb. 2, 2017, 4:22 p.m. UTC | #1
On Thu, Feb 02, 2017 at 03:46:36PM +0000, Wei Liu wrote:
> Otherwise it is leaked. Found by code inspection.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Fatih Acar <fatih.acar@gandi.net>
> 
> Backport candidate.
> ---
>  tools/libxl/xl_cmdimpl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 7e8a8ae5c4..9bf10dfcb2 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -3145,6 +3145,7 @@ start:
>              case DOMAIN_RESTART_RENAME:
>                  if (domid_soft_reset == INVALID_DOMID &&
>                      !preserve_domain(&domid, event, &d_config)) {
> +                    libxl_event_free(event);

Stupid me.

This should have been

 libxl_event_free(ctx, event);

>                      /* If we fail then exit leaving the old domain in place. */
>                      ret = -1;
>                      goto out;
> -- 
> 2.11.0
>
Ian Jackson Feb. 3, 2017, 11:57 a.m. UTC | #2
Wei Liu writes ("[PATCH 1/2] xl: free event in DOMAIN_RESTART_RENAME error path"):
> Otherwise it is leaked. Found by code inspection.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 7e8a8ae5c4..9bf10dfcb2 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3145,6 +3145,7 @@  start:
             case DOMAIN_RESTART_RENAME:
                 if (domid_soft_reset == INVALID_DOMID &&
                     !preserve_domain(&domid, event, &d_config)) {
+                    libxl_event_free(event);
                     /* If we fail then exit leaving the old domain in place. */
                     ret = -1;
                     goto out;