[Openmp-commits] [openmp] a23d728 - openmp: fix memcpy memory leak

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 12 21:25:53 PDT 2020


Author: Tom Scogland
Date: 2020-03-12T23:24:16-05:00
New Revision: a23d7282ca719f753de691c568ded60f8562270e

URL: https://github.com/llvm/llvm-project/commit/a23d7282ca719f753de691c568ded60f8562270e
DIFF: https://github.com/llvm/llvm-project/commit/a23d7282ca719f753de691c568ded60f8562270e.diff

LOG: openmp: fix memcpy memory leak

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D72637

Added: 
    

Modified: 
    openmp/libomptarget/src/api.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp
index 9d4a2efcc15b..cabe63927f5a 100644
--- a/openmp/libomptarget/src/api.cpp
+++ b/openmp/libomptarget/src/api.cpp
@@ -174,6 +174,7 @@ EXTERN int omp_target_memcpy(void *dst, void *src, size_t length,
     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);


        


More information about the Openmp-commits mailing list