Skip to content

Commit

Permalink
fix leak in move operator= on SimpleArray
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
luigi-rosso and luigi-rosso committed Aug 5, 2023
1 parent f075873 commit e61c62a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b3a367dad684d94cbe77a80adcc89bf07858d0ad
2f67af55fca257ebfa87c933040de0c9c5142e0e
2 changes: 1 addition & 1 deletion dev/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ elif [ "$OPTION" = "clean" ]; then
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...
Expand Down
6 changes: 4 additions & 2 deletions include/rive/simple_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ template <typename T> class SimpleArray

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;
Expand Down

0 comments on commit e61c62a

Please sign in to comment.