X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fcontext.c;h=5c9f4b06401d0dc23592d23c66b8bb3751fcd3f2;hb=d0d82191bdac8626adf2489b89279f47805282ea;hp=dca4cb2b4fc4605735f795872570ae34456c82b7;hpb=7f89ddce05f0a5c985d6333fbe70a992da4bd244;p=babeltrace.git diff --git a/lib/context.c b/lib/context.c index dca4cb2b..5c9f4b06 100644 --- a/lib/context.c +++ b/lib/context.c @@ -32,7 +32,6 @@ #include #include -#include #include /* For O_RDONLY */ #include @@ -104,7 +103,7 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path, fprintf(stderr, "[error] [Context] Creating trace handle %s .\n\n", path); ret = -1; - goto end; + goto error; } handle->format = fmt; handle->td = td; @@ -124,11 +123,11 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path, handle); ret = trace_collection_add(ctx->tc, td); if (ret != 0) - goto end; + goto error; ret = fmt->convert_index_timestamp(td); if (ret < 0) - goto end; + goto error; handle->real_timestamp_begin = fmt->timestamp_begin(td, handle, BT_CLOCK_REAL); handle->real_timestamp_end = fmt->timestamp_end(td, handle, BT_CLOCK_REAL); @@ -136,6 +135,9 @@ int bt_context_add_trace(struct bt_context *ctx, const char *path, handle->cycles_timestamp_end = fmt->timestamp_end(td, handle, BT_CLOCK_CYCLES); return handle->id; + +error: + fmt->close_trace(td); end: return ret; } @@ -169,7 +171,8 @@ void bt_context_destroy(struct bt_context *ctx) assert(ctx); finalize_trace_collection(ctx->tc); - /* Remote all traces. The g_hash_table_destroy will call + /* + * Remove all traces. The g_hash_table_destroy will call * bt_trace_handle_destroy on each elements. */ g_hash_table_destroy(ctx->trace_handles);