Commit 1c05e50d authored by Erwan Tulou's avatar Erwan Tulou Committed by Jean-Baptiste Kempf

skins2: fix memory leak (a malloc not paired with a free)

(cherry picked from commit 4337a2d9)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7146c0c0
...@@ -71,8 +71,18 @@ class CmdPlaytreeAppend: public CmdGeneric ...@@ -71,8 +71,18 @@ class CmdPlaytreeAppend: public CmdGeneric
{ {
public: public:
CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ): CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ):
CmdGeneric( pIntf ), m_pAdd( p_add ) { } CmdGeneric( pIntf ), m_pAdd( NULL )
virtual ~CmdPlaytreeAppend() { } {
if( p_add )
{
m_pAdd = new playlist_add_t;
*m_pAdd = *p_add;
}
}
virtual ~CmdPlaytreeAppend()
{
delete m_pAdd;
}
virtual void execute(); virtual void execute();
virtual string getType() const { return "playtree append"; } virtual string getType() const { return "playtree append"; }
......
...@@ -287,10 +287,7 @@ int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable, ...@@ -287,10 +287,7 @@ int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
{ {
VlcProc *pThis = (VlcProc*)pParam; VlcProc *pThis = (VlcProc*)pParam;
playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof( playlist_add_t *p_add = static_cast<playlist_add_t*>(newVal.p_address);
playlist_add_t ) ) ;
memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
CmdGenericPtr ptrTree; CmdGenericPtr ptrTree;
CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(), CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment