fix leak in move operator= on SimpleArray And add memory tests to github actions! Diffs= 2f67af55f fix leak in move operator= on SimpleArray (#5752) Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index 65381f7..e4b86b4 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -b3a367dad684d94cbe77a80adcc89bf07858d0ad +2f67af55fca257ebfa87c933040de0c9c5142e0e
diff --git a/dev/test.sh b/dev/test.sh index b11c94b..87eb274 100755 --- a/dev/test.sh +++ b/dev/test.sh
@@ -20,7 +20,7 @@ shift elif [ "$OPTION" = "memory" ]; then echo Will perform memory checks... - UTILITY='valgrind --leak-check=full' + UTILITY='leaks --atExit --' shift elif [ "$OPTION" = "debug" ]; then echo Starting debugger...
diff --git a/include/rive/simple_array.hpp b/include/rive/simple_array.hpp index c295abe..25ef8dd 100644 --- a/include/rive/simple_array.hpp +++ b/include/rive/simple_array.hpp
@@ -101,8 +101,10 @@ SimpleArray<T>& operator=(SimpleArray<T>&& other) { - this->m_ptr = other.m_ptr; - this->m_size = other.m_size; + SimpleArrayHelper<T>::DestructArray(m_ptr, m_ptr + m_size); + free(m_ptr); + m_ptr = other.m_ptr; + m_size = other.m_size; other.m_ptr = nullptr; other.m_size = 0; return *this;