[Filter] fix a memory leak
authorHyoung Joo Ahn <hello.ahn@samsung.com>
Thu, 25 Jun 2020 10:39:34 +0000 (19:39 +0900)
committerGeunsik Lim <leemgs@users.noreply.github.com>
Thu, 25 Jun 2020 12:03:50 +0000 (21:03 +0900)
the allocated memory(when `allocate_in_invoke` is FALSE) should be free when `invoke()` returns not 0(OK)

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
gst/nnstreamer/tensor_filter/tensor_filter.c

index 8527fe7..2d07869 100644 (file)
@@ -542,6 +542,8 @@ gst_tensor_filter_transform (GstBaseTransform * trans,
     /* append the memory block to outbuf */
     if (ret == 0)
       gst_buffer_append_memory (outbuf, out_mem[i]);
+    else if (allocate_in_invoke == FALSE)
+      gst_allocator_free (out_mem[i]->allocator, out_mem[i]);
   }
 
   for (i = 0; i < prop->input_meta.num_tensors; i++) {