summaryrefslogtreecommitdiff
path: root/va/va_trace.c
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2017-09-28 09:45:46 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2017-09-28 12:15:05 +0800
commit4cb1712312be9d852b71bdf4da5eadbb1dc1adc6 (patch)
tree852d8886df750e2ab5f7eeb738511983d032d43a /va/va_trace.c
parent98f1d56bfe9a11c0bcc3e1f4194779e0b777e77e (diff)
downloadlibva-4cb1712312be9d852b71bdf4da5eadbb1dc1adc6.tar.gz
Fix segmentation fault in VA tracer
The first parameter of va_{error,info}Message is VADisplay This fixes https://github.com/01org/libva/issues/123 Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Diffstat (limited to 'va/va_trace.c')
-rwxr-xr-xva/va_trace.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/va/va_trace.c b/va/va_trace.c
index 8e78732..29332fd 100755
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -561,13 +561,13 @@ static int open_tracing_specil_file(
if(type == 0) {
ptra_ctx->trace_codedbuf_fn = fn_env;
ptra_ctx->trace_fp_codedbuf = fp;
- va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
+ va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_CODEDBUF is on, save codedbuf into %s\n",
fn_env);
}
else {
ptra_ctx->trace_surface_fn = fn_env;
ptra_ctx->trace_fp_surface = fp;
- va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
+ va_infoMessage(pva_trace->dpy, "LIBVA_TRACE_SURFACE is on, save surface into %s\n",
fn_env);
}
@@ -615,7 +615,7 @@ static int open_tracing_log_file(
if(!pfp)
goto FAIL;
- va_infoMessage("%s %s for the thread 0x%08x\n",
+ va_infoMessage(pva_trace->dpy, "%s %s for the thread 0x%08x\n",
new_fn_flag ? "Open new log file" : "Append to log file",
plog_file->fn_log, thd_id);
@@ -741,6 +741,8 @@ void va_TraceInit(VADisplay dpy)
return;
}
+ pva_trace->dpy = dpy;
+
if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
pva_trace->fn_log_env = strdup(env_value);
trace_ctx->plog_file = start_tracing2log_file(pva_trace);
@@ -748,11 +750,11 @@ void va_TraceInit(VADisplay dpy)
trace_ctx->plog_file_list[0] = trace_ctx->plog_file;
va_trace_flag = VA_TRACE_FLAG_LOG;
- va_infoMessage("LIBVA_TRACE is on, save log into %s\n",
+ va_infoMessage(dpy, "LIBVA_TRACE is on, save log into %s\n",
trace_ctx->plog_file->fn_log);
}
else
- va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
+ va_errorMessage(dpy, "Open file %s failed (%s)\n", env_value, strerror(errno));
}
/* may re-get the global settings for multiple context */
@@ -810,7 +812,6 @@ void va_TraceInit(VADisplay dpy)
pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM] = trace_ctx;
((VADisplayContextP)dpy)->vatrace = (void *)pva_trace;
- pva_trace->dpy = dpy;
if(!va_trace_flag)
va_TraceEnd(dpy);
@@ -882,6 +883,7 @@ void va_TraceEnd(VADisplay dpy)
}
free(pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM]);
+ pva_trace->dpy = NULL;
free(pva_trace);
((VADisplayContextP)dpy)->vatrace = NULL;
}