From 663bd9ff01e820aedcc26061e4c5195dc550d26f Mon Sep 17 00:00:00 2001 From: yangxx Date: Wed, 23 Jul 2003 20:35:36 +0000 Subject: [PATCH] git-svn-id: http://ltt.polymtl.ca/svn@133 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/tracefile.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index f3ee2e20..2f3f7ab4 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -103,6 +103,9 @@ LttTracefile* ltt_tracefile_open(LttTrace * t, char * fileName) // Is the file large enough to contain a trace if(lTDFStat.st_size < sizeof(BlockStart) + EVENT_HEADER_SIZE){ g_print("The input data file %s does not contain a trace\n", fileName); + g_free(tf->name); + close(tf->fd); + g_free(tf); return NULL; } @@ -192,6 +195,7 @@ void ltt_tracefile_close(LttTracefile *t) { g_free(t->name); g_free(t->buffer); + close(t->fd); g_free(t); } @@ -791,7 +795,10 @@ LttEvent *ltt_tracefile_read(LttTracefile *t) //update the fields of the current event and go to the next event err = skipEvent(t); - if(err == ENOMEM) return NULL; + if(err == ENOMEM){ + g_free(lttEvent); + return NULL; + } if(err == ENOENT) return lttEvent; if(err == ERANGE) g_error("event id is out of range\n"); if(err)g_error("Can not read tracefile\n"); -- 2.34.1