diff mbox

[1/8] tools/xenalyze: Close symbol_file after reading it

Message ID 1456411743-17741-2-git-send-email-george.dunlap@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

George Dunlap Feb. 25, 2016, 2:48 p.m. UTC
...to avoid leaking the FD and associated memory.

CID 1306872

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
Not sure if this will actually make coverity happy, or if we need to
actually set symbol_file to NULL.

CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/xentrace/xenalyze.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ian Jackson Feb. 26, 2016, 12:22 p.m. UTC | #1
George Dunlap writes ("[PATCH 1/8] tools/xenalyze: Close symbol_file after reading it"):
> ...to avoid leaking the FD and associated memory.
> 
> CID 1306872
> 
> Signed-off-by: George Dunlap <george.dunlap@citrix.com>

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

> Not sure if this will actually make coverity happy, or if we need to
> actually set symbol_file to NULL.

I don't see why you'd need to assign to the symbol_file local (which
is about to go out of scope).

Ian.
Konrad Rzeszutek Wilk Feb. 29, 2016, 4:11 p.m. UTC | #2
On Fri, Feb 26, 2016 at 12:22:39PM +0000, Ian Jackson wrote:
> George Dunlap writes ("[PATCH 1/8] tools/xenalyze: Close symbol_file after reading it"):
> > ...to avoid leaking the FD and associated memory.
> > 
> > CID 1306872
> > 
> > Signed-off-by: George Dunlap <george.dunlap@citrix.com>
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

And applied.
> 
> > Not sure if this will actually make coverity happy, or if we need to
> > actually set symbol_file to NULL.
> 
> I don't see why you'd need to assign to the symbol_file local (which
> is about to go out of scope).
> 
> Ian.
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 1651302..3c90a0f 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -363,6 +363,8 @@  void parse_symbol_file(char *fn) {
             p=&((*p)->next);
         }
     }
+
+    fclose(symbol_file);
 }
 
 /* WARNING not thread safe */