From: Andrew Cooper Date: Mon, 25 Nov 2013 11:05:48 +0000 (+0000) Subject: tools/xenctx: Prevent leaking a file handle on error paths X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5881 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=022d4ee27cee157949ab70c928cbf77d8cda0e3b;p=xen.git tools/xenctx: Prevent leaking a file handle on error paths Coverity ID: 1126110 Signed-off-by: Andrew Cooper CC: Ian Campbell Acked-by: Ian Jackson --- diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index 57e3277652..ba502fd5dc 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; }