Skip to content

Commit

Permalink
LibGUI, ADS: Fix issues found by valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
kperdlich committed Sep 27, 2024
1 parent c568e09 commit 1cca624
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ADS/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class BasicString {
public:
BasicString() = default;

~BasicString()
{
clear();
}

explicit BasicString(const T value)
{
m_capacity = 2;
Expand Down
2 changes: 1 addition & 1 deletion ADS/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class Vector {
if (m_capacity < newSize)
reserve(newSize + s_capacityIncrement);
for (ADS::size_t i = m_size; i < newSize; ++i)
m_data[i] = {};
new (&m_data[i]) T{};
m_size = newSize;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Userland/LibGUI/Bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Bitmap::Bitmap(BitmapFormat format, Size size, char* data, size_t dataSize, OwnB
Bitmap::~Bitmap()
{
if (m_isOwning && m_data) {
delete m_data;
delete[] m_data;
m_data = nullptr;
}
}
Expand Down

0 comments on commit 1cca624

Please sign in to comment.