[vlc-commits] skins2: fix leak

Steve Lhomme git at videolan.org
Wed Apr 3 09:56:00 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr  3 09:09:11 2019 +0200| [212cd26500ceffe0d7155ca1d37793336c561ac4] | committer: Steve Lhomme

skins2: fix leak

We actually want a WCHAR when calling the Win32 API. And we need to release the
string we just allocated.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=212cd26500ceffe0d7155ca1d37793336c561ac4
---

 modules/gui/skins2/win32/win32_popup.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/win32/win32_popup.cpp b/modules/gui/skins2/win32/win32_popup.cpp
index 8c9d6fff37..f611301dca 100644
--- a/modules/gui/skins2/win32/win32_popup.cpp
+++ b/modules/gui/skins2/win32/win32_popup.cpp
@@ -73,10 +73,11 @@ void Win32Popup::addItem( const std::string &rLabel, int pos )
 //     menuItem.fType = MFT_STRING;
     menuItem.fMask = MIIM_ID | MIIM_STRING;
     menuItem.wID = pos;
-    menuItem.dwTypeData = ToT(rLabel.c_str());
+    menuItem.dwTypeData = ToWide(rLabel.c_str());
     menuItem.cch = rLabel.size();
 
     InsertMenuItem( m_hMenu, findInsertionPoint( pos ), TRUE, &menuItem );
+    free(menuItem.dwTypeData);
 }
 
 



More information about the vlc-commits mailing list