diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-07-08 15:39:11 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-07-08 15:39:11 +0200 |
commit | fa8a4b44497cfd3dd35eec393b65288bee90be40 (patch) | |
tree | 01fc1c4ae1a0380e2c8c2bb6b3320b617d6a5efc /src/Buffer.cpp | |
parent | 30f226d61dde209873ee157c031f63b32856de7a (diff) | |
download | dabmod-fa8a4b44497cfd3dd35eec393b65288bee90be40.tar.gz dabmod-fa8a4b44497cfd3dd35eec393b65288bee90be40.tar.bz2 dabmod-fa8a4b44497cfd3dd35eec393b65288bee90be40.zip |
Fix Buffer memory leak when using move-assignment
Diffstat (limited to 'src/Buffer.cpp')
-rw-r--r-- | src/Buffer.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 002c1eb..ab50f1a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -97,6 +97,9 @@ Buffer& Buffer::operator=(Buffer&& other) if (&other != this) { m_len = other.m_len; m_capacity = other.m_capacity; + if (m_data != nullptr) { + free(m_data); + } m_data = other.m_data; other.m_len = 0; |