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 4337a2d9b9e125f0619e1e7ffc390ce161d76284)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7146c0c0
......@@ -71,8 +71,18 @@ class CmdPlaytreeAppend: public CmdGeneric
{
public:
CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ):
CmdGeneric( pIntf ), m_pAdd( p_add ) { }
virtual ~CmdPlaytreeAppend() { }
CmdGeneric( pIntf ), m_pAdd( NULL )
{
if( p_add )
{
m_pAdd = new playlist_add_t;
*m_pAdd = *p_add;
}
}
virtual ~CmdPlaytreeAppend()
{
delete m_pAdd;
}
virtual void execute();
virtual string getType() const { return "playtree append"; }
......
......@@ -287,10 +287,7 @@ int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
{
VlcProc *pThis = (VlcProc*)pParam;
playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
playlist_add_t ) ) ;
memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
playlist_add_t *p_add = static_cast<playlist_add_t*>(newVal.p_address);
CmdGenericPtr ptrTree;
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