OSDN Git Service
(root)
/
winmerge-jp
/
winmerge-jp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0d1330
)
Fix memory leaks (#596)
author
hlop
<thehlopster@gmail.com>
Mon, 1 Feb 2021 23:35:19 +0000
(
02:35
+0300)
committer
GitHub
<noreply@github.com>
Mon, 1 Feb 2021 23:35:19 +0000
(08:35 +0900)
Allocated array should be deallocated with `delete []` Deallocating it with `delete` can cause memory leaks.
Plugins/src_VCPP/RCLocalizationHelper/widestr.h
patch
|
blob
|
history
diff --git
a/Plugins/src_VCPP/RCLocalizationHelper/widestr.h
b/Plugins/src_VCPP/RCLocalizationHelper/widestr.h
index
7a067e4
..
a5d655a
100644
(file)
--- a/
Plugins/src_VCPP/RCLocalizationHelper/widestr.h
+++ b/
Plugins/src_VCPP/RCLocalizationHelper/widestr.h
@@
-48,7
+48,7
@@
public:
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)
{
@@
-80,7
+80,7
@@
public:
private:
void release()
{
- delete m_wstr;
+ delete
[]
m_wstr;
m_wstr = 0;
}
void update()