Mesa (master): u_dynarray: fix coverity warning about ignoring return value from reralloc

Dave Airlie airlied at kemper.freedesktop.org
Mon Jun 12 20:40:48 UTC 2017


Module: Mesa
Branch: master
Commit: ca69b5e78c49be2474dab7be92161cd9f957c4e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca69b5e78c49be2474dab7be92161cd9f957c4e7

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jun 13 05:50:18 2017 +1000

u_dynarray: fix coverity warning about ignoring return value from reralloc

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

Reviewed-by: Thomas Helland<thomashelland90 at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
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 e9109ccd2d..fdcd09c4be 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);
          }




More information about the mesa-commit mailing list