From 9d40fdba47cb0f417937f804f8adcae4cf972a29 Mon Sep 17 00:00:00 2001
From: xiyehu2 <xiyehu2@illinois.edu>
Date: Mon, 23 Oct 2023 17:16:21 -0500
Subject: [PATCH] bugfixing in unbindBuffer in relation to dataLen

---
 Cpp/lib/waveform.cpp | 2 +-
 Cpp/src/example.cpp  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cpp/lib/waveform.cpp b/Cpp/lib/waveform.cpp
index 2162a7e..1bfabc7 100644
--- a/Cpp/lib/waveform.cpp
+++ b/Cpp/lib/waveform.cpp
@@ -199,7 +199,7 @@ void ArrayWaveform::bindBuffer(int64_t bytes) {
 
 void ArrayWaveform::unbindBuffer() {
     if (this->dataLen != 0 and this->pDataBuffer != nullptr) {
-        munmap(this->pDataBuffer, this->dataLen);
+        munmap(this->pDataBuffer, this->dataLen * 2);
         this->pDataBuffer = nullptr;
         this->dataLen = 0;
     }
diff --git a/Cpp/src/example.cpp b/Cpp/src/example.cpp
index 73856e5..c7b89e0 100644
--- a/Cpp/src/example.cpp
+++ b/Cpp/src/example.cpp
@@ -51,7 +51,7 @@ int main() {
     awg.writeSeqModeSegment(
         1,
         wfmData.first,
-        wfmData.second
+        wfmData.second * 2
     ); // load wfms onto both memory segements for simplicity,
        // a memory segment needs only be initialized with data
        // if it is configured as part of the step sequence below
-- 
GitLab