diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2013-08-12 14:52:14 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2014-03-17 09:36:52 +0800 |
commit | a360c485be18137b93f95d3fa81943c567bf9bd4 (patch) | |
tree | 0a199e0c11eb479589dbb68765c22f0547abc34c /va | |
parent | 45cc9daf82003eeb93f0987f8cec1a3bf1557fce (diff) | |
download | libva-a360c485be18137b93f95d3fa81943c567bf9bd4.tar.gz |
vatrace: check the pointer against NULL before using it
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 7ae3f1f3666e3571774a9b98ee6571433dcc73d5)
Diffstat (limited to 'va')
-rw-r--r-- | va/va_trace.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/va/va_trace.c b/va/va_trace.c index f50bd84..17bf113 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -357,6 +357,9 @@ void va_TraceSurface(VADisplay dpy) unsigned char check_sum = 0; DPY2TRACECTX(dpy); + if (!trace_ctx->trace_fp_surface) + return; + va_TraceMsg(trace_ctx, "==========dump surface data in file %s\n", trace_ctx->trace_surface_fn); if ((file_size(trace_ctx->trace_fp_surface) >= trace_logsize)) { @@ -403,20 +406,18 @@ void va_TraceSurface(VADisplay dpy) tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff; for (i=0; i<trace_ctx->trace_surface_height; i++) { - if (trace_ctx->trace_fp_surface) - fwrite(tmp + trace_ctx->trace_surface_xoff, - trace_ctx->trace_surface_width, - 1, trace_ctx->trace_fp_surface); + fwrite(tmp + trace_ctx->trace_surface_xoff, + trace_ctx->trace_surface_width, + 1, trace_ctx->trace_fp_surface); tmp += luma_stride; } tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff; if (fourcc == VA_FOURCC_NV12) { for (i=0; i<trace_ctx->trace_surface_height/2; i++) { - if (trace_ctx->trace_fp_surface) - fwrite(tmp + trace_ctx->trace_surface_xoff, - trace_ctx->trace_surface_width, - 1, trace_ctx->trace_fp_surface); + fwrite(tmp + trace_ctx->trace_surface_xoff, + trace_ctx->trace_surface_width, + 1, trace_ctx->trace_fp_surface); tmp += chroma_u_stride; } |