[Openmp-commits] [PATCH] D72637: openmp: fix memcpy memory leak

Tom Scogland via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 13 12:09:28 PST 2020


trws created this revision.
trws added a reviewer: jdoerfert.
Herald added a subscriber: guansong.

https://reviews.llvm.org/D72637

Files:
  openmp/libomptarget/src/api.cpp


Index: openmp/libomptarget/src/api.cpp
===================================================================
--- openmp/libomptarget/src/api.cpp
+++ openmp/libomptarget/src/api.cpp
@@ -174,12 +174,13 @@
     rc = SrcDev.data_retrieve(buffer, srcAddr, length);
     if (rc == OFFLOAD_SUCCESS)
       rc = DstDev.data_submit(dstAddr, buffer, length);
+    free(buffer);
   }

   DP("omp_target_memcpy returns %d\n", rc);
   return rc;
 }

 EXTERN int omp_target_memcpy_rect(void *dst, void *src, size_t element_size,
     int num_dims, const size_t *volume, const size_t *dst_offsets,
     const size_t *src_offsets, const size_t *dst_dimensions,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72637.237744.patch
Type: text/x-patch
Size: 643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200113/7d5e5c6e/attachment.bin>


More information about the Openmp-commits mailing list