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

[Xen-devel] [PATCH 2/5] tools/xenctx: Prevent leaking a file handle on error paths



Coverity ID: 1126110

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/xentrace/xenctx.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 57e3277..ba502fd 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -208,13 +208,16 @@ static void read_symbol_table(const char *symtab)
             continue;
         default:
             symbol = malloc(sizeof(*symbol));
-            if (symbol == NULL)
+            if (symbol == NULL) {
+                fclose(f);
                 return;
+            }
 
             symbol->address = address;
             symbol->name = strdup(p);
             if (symbol->name == NULL) {
                 free(symbol);
+                fclose(f);
                 return;
             }
 
-- 
1.7.10.4


_______________________________________________
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®.