Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-intel-libva: Commit

hardware/intel/libva


Commit MetaInfo

Révision2d27be4fe667db77e9ca7ad17fb944908143bff6 (tree)
l'heure2016-05-28 06:38:07
Auteurpeng.chen <peng.c.chen@inte...>
CommiterSean V Kelley

Message de Log

fix check NULL issues

v2:
code clean up

v1:
initial

Signed-off-by: peng.chen <peng.c.chen@intel.com>

Change Summary

Modification

--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -501,7 +501,10 @@ static void FILE_NAME_SUFFIX(
501501 int tmp = strnlen(env_value, max_size);
502502 int left = max_size - tmp;
503503 struct timeval tv;
504- int size = strlen(suffix_str);
504+ int size = 0;
505+
506+ if (suffix_str)
507+ strlen(suffix_str);
505508
506509 if(left < (size + 8 + 10))
507510 return;
@@ -735,8 +738,12 @@ void va_TraceInit(VADisplay dpy)
735738 struct va_trace *pva_trace = calloc(sizeof(struct va_trace), 1);
736739 struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1);
737740
738- if (pva_trace == NULL || trace_ctx == NULL)
741+ if (pva_trace == NULL || trace_ctx == NULL) {
742+ free(pva_trace);
743+ free(trace_ctx);
744+
739745 return;
746+ }
740747
741748 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
742749 pva_trace->fn_log_env = strdup(env_value);
@@ -1474,6 +1481,9 @@ void va_TraceCreateBuffer (
14741481 VABufferID *buf_id /* out */
14751482 )
14761483 {
1484+ if (!buf_id || *buf_id == VA_INVALID_ID)
1485+ return;
1486+
14771487 DPY2TRACECTX(dpy, context, VA_INVALID_ID);
14781488
14791489 add_trace_buf_info(pva_trace, context, *buf_id);
@@ -1503,7 +1513,10 @@ void va_TraceDestroyBuffer (
15031513
15041514 VACodedBufferSegment *buf_list;
15051515 int i = 0;
1506-
1516+
1517+ if (buf_id == VA_INVALID_ID)
1518+ return;
1519+
15071520 DPY2TRACECTX(dpy, VA_INVALID_ID, buf_id);
15081521
15091522 vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
Afficher sur ancien navigateur de dépôt.