Skip to content

Commit

Permalink
Merge pull request #2636 from JasonRuonanWang/mgard-memory-leak
Browse files Browse the repository at this point in the history
fixed memory leak in mgard operator
  • Loading branch information
JasonRuonanWang authored Feb 22, 2021
2 parents 19982f8 + 2141857 commit b92a2e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/adios2/operator/compress/CompressMGARD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ size_t CompressMGARD::Compress(const void *dataIn, const Dims &dimensions,
const size_t sizeOutT = static_cast<size_t>(sizeOut);
std::memcpy(bufferOut, dataOutPtr, sizeOutT);

free(dataOutPtr);
dataOutPtr = nullptr;

return sizeOutT;
}

Expand Down Expand Up @@ -141,6 +144,9 @@ size_t CompressMGARD::Decompress(const void *bufferIn, const size_t sizeIn,
const size_t dataSizeBytes = helper::GetTotalSize(dimensions) * elementSize;
std::memcpy(dataOut, dataPtr, dataSizeBytes);

free(dataPtr);
dataPtr = nullptr;

return static_cast<size_t>(dataSizeBytes);
}

Expand Down

0 comments on commit b92a2e8

Please sign in to comment.