diff mbox

[1/2] xenmon: close qos_fd when finished with it in alloc_qos_data

Message ID 1455121585-22659-1-git-send-email-ian.campbell@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Campbell Feb. 10, 2016, 4:26 p.m. UTC
Otherwise the fd is leaked. NB the mmap'd memory in the global
cpu_qos_data[n] is not affected by closing the underlying fd.

Compile tested only.

CID: 1055930

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/xenmon/xenbaked.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Wei Liu Feb. 11, 2016, 11:18 a.m. UTC | #1
On Wed, Feb 10, 2016 at 04:26:24PM +0000, Ian Campbell wrote:
> Otherwise the fd is leaked. NB the mmap'd memory in the global
> cpu_qos_data[n] is not affected by closing the underlying fd.
> 
> Compile tested only.
> 
> CID: 1055930
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/xenmon/xenbaked.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
> index eacacb0..782f0c1 100644
> --- a/tools/xenmon/xenbaked.c
> +++ b/tools/xenmon/xenbaked.c
> @@ -689,6 +689,7 @@ static void alloc_qos_data(int ncpu)
>          cpu_qos_data[n] = new_qos;
>      }
>      free(dummy);
> +    close(qos_fd);
>      new_qos = NULL;
>  }
>  
> -- 
> 2.1.4
>
Ian Campbell Feb. 11, 2016, 3:38 p.m. UTC | #2
On Thu, 2016-02-11 at 11:18 +0000, Wei Liu wrote:
> On Wed, Feb 10, 2016 at 04:26:24PM +0000, Ian Campbell wrote:
> > Otherwise the fd is leaked. NB the mmap'd memory in the global
> > cpu_qos_data[n] is not affected by closing the underlying fd.
> > 
> > Compile tested only.
> > 
> > CID: 1055930
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Applied both, thanks.
diff mbox

Patch

diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index eacacb0..782f0c1 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -689,6 +689,7 @@  static void alloc_qos_data(int ncpu)
         cpu_qos_data[n] = new_qos;
     }
     free(dummy);
+    close(qos_fd);
     new_qos = NULL;
 }