u_dynarray: fix coverity warning about ignoring return value from reralloc
authorDave Airlie <airlied@redhat.com>
Mon, 12 Jun 2017 19:50:18 +0000 (05:50 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 12 Jun 2017 20:40:25 +0000 (06:40 +1000)
>>>     Ignoring storage allocated by "reralloc_size(buf->mem_ctx, buf->data, buf->size)" leaks it.

Reviewed-by: Thomas Helland<thomashelland90@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/util/u_dynarray.h

index e9109ccd2d1e3c82697083aa18cb72b58870db98..fdcd09c4befeae7abdcb69c51a19a9caef0b0dda 100644 (file)
@@ -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);
          }