Commit 4337a2d9 authored by Erwan Tulou's avatar Erwan Tulou

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

parent a47b7c7a
......@@ -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