Skip to content

Commit

Permalink
Fix memory leaks (#596)
Browse files Browse the repository at this point in the history
Allocated array should be deallocated with `delete []` Deallocating it with `delete` can cause memory leaks.
  • Loading branch information
thehlopster authored Feb 1, 2021
1 parent a0d1330 commit d8d9b8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Plugins/src_VCPP/RCLocalizationHelper/widestr.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class widestr
m_wstr = (wchar_t *)new wchar_t[maxlen];
m_maxlen = maxlen;
wcscpy(m_wstr, old ? old : L"");
if (old) { delete (wchar_t *)old; }
if (old) { delete[] (wchar_t *)old; }
}
void append(const wchar_t * wstr, int maxlen=-1)
{
Expand Down Expand Up @@ -80,7 +80,7 @@ class widestr
private:
void release()
{
delete m_wstr;
delete[] m_wstr;
m_wstr = 0;
}
void update()
Expand Down

0 comments on commit d8d9b8b

Please sign in to comment.