[Mesa-dev] [PATCH] u_dynarray: fix coverity warning about ignoring return value from reralloc

Dave Airlie airlied at gmail.com
Mon Jun 12 19:50:50 UTC 2017


From: Dave Airlie <airlied at redhat.com>

>>>     Ignoring storage allocated by "reralloc_size(buf->mem_ctx, buf->data, buf->size)" leaks it.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/util/u_dynarray.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h
index e9109cc..fdcd09c 100644
--- a/src/util/u_dynarray.h
+++ b/src/util/u_dynarray.h
@@ -107,7 +107,7 @@ util_dynarray_trim(struct util_dynarray *buf)
    if (buf->size != buf->capacity) {
       if (buf->size) {
          if (buf->mem_ctx) {
-            reralloc_size(buf->mem_ctx, buf->data, buf->size);
+            buf->data = reralloc_size(buf->mem_ctx, buf->data, buf->size);
          } else {
             buf->data = realloc(buf->data, buf->size);
          }
-- 
2.9.4



More information about the mesa-dev mailing list