hardware/intel/libva
Revisión | 2d27be4fe667db77e9ca7ad17fb944908143bff6 (tree) |
---|---|
Tiempo | 2016-05-28 06:38:07 |
Autor | peng.chen <peng.c.chen@inte...> |
Commiter | Sean V Kelley |
fix check NULL issues
v2:
code clean up
v1:
initial
Signed-off-by: peng.chen <peng.c.chen@intel.com>
@@ -501,7 +501,10 @@ static void FILE_NAME_SUFFIX( | ||
501 | 501 | int tmp = strnlen(env_value, max_size); |
502 | 502 | int left = max_size - tmp; |
503 | 503 | struct timeval tv; |
504 | - int size = strlen(suffix_str); | |
504 | + int size = 0; | |
505 | + | |
506 | + if (suffix_str) | |
507 | + strlen(suffix_str); | |
505 | 508 | |
506 | 509 | if(left < (size + 8 + 10)) |
507 | 510 | return; |
@@ -735,8 +738,12 @@ void va_TraceInit(VADisplay dpy) | ||
735 | 738 | struct va_trace *pva_trace = calloc(sizeof(struct va_trace), 1); |
736 | 739 | struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1); |
737 | 740 | |
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 | + | |
739 | 745 | return; |
746 | + } | |
740 | 747 | |
741 | 748 | if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) { |
742 | 749 | pva_trace->fn_log_env = strdup(env_value); |
@@ -1474,6 +1481,9 @@ void va_TraceCreateBuffer ( | ||
1474 | 1481 | VABufferID *buf_id /* out */ |
1475 | 1482 | ) |
1476 | 1483 | { |
1484 | + if (!buf_id || *buf_id == VA_INVALID_ID) | |
1485 | + return; | |
1486 | + | |
1477 | 1487 | DPY2TRACECTX(dpy, context, VA_INVALID_ID); |
1478 | 1488 | |
1479 | 1489 | add_trace_buf_info(pva_trace, context, *buf_id); |
@@ -1503,7 +1513,10 @@ void va_TraceDestroyBuffer ( | ||
1503 | 1513 | |
1504 | 1514 | VACodedBufferSegment *buf_list; |
1505 | 1515 | int i = 0; |
1506 | - | |
1516 | + | |
1517 | + if (buf_id == VA_INVALID_ID) | |
1518 | + return; | |
1519 | + | |
1507 | 1520 | DPY2TRACECTX(dpy, VA_INVALID_ID, buf_id); |
1508 | 1521 | |
1509 | 1522 | vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements); |