[vlc-commits] skins: use new/delete for vout_window opaque data

Rémi Denis-Courmont git at videolan.org
Sun Dec 2 19:00:26 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec  1 18:03:27 2018 +0200| [f8568de3d24e56b420265c3049c49c3537d9791f] | committer: Rémi Denis-Courmont

skins: use new/delete for vout_window opaque data

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

 modules/gui/skins2/src/skin_main.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index da0fae219e..2129ff045e 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -393,7 +393,7 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
         return VLC_EGENERIC;
     }
 
-    sys = (vout_window_sys_t*)calloc( 1, sizeof( *sys ) );
+    sys = new (std::nothrow) vout_window_sys_t;
     if( !sys )
     {
         vlc_object_release( pIntf );
@@ -401,8 +401,8 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
     }
 
     pWnd->sys = sys;
-    pWnd->sys->cfg = *cfg;
-    pWnd->sys->pIntf = pIntf;
+    sys->cfg = *cfg;
+    sys->pIntf = pIntf;
     pWnd->ops = &window_ops;
 
     pWnd->type = VOUT_WINDOW_TYPE_DUMMY;
@@ -415,7 +415,7 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
     if( pWnd->type == VOUT_WINDOW_TYPE_DUMMY )
     {
         msg_Dbg( pIntf, "Vout window creation failed" );
-        free( sys );
+        delete sys;
         vlc_object_release( pIntf );
         return VLC_EGENERIC;
     }
@@ -436,7 +436,7 @@ static void WindowClose( vout_window_t *pWnd )
     CmdExecuteBlock::executeWait( CmdGenericPtr( cmd ) );
 
     vlc_object_release( sys->pIntf );
-    free( sys );
+    delete sys;
 }
 
 static int WindowControl( vout_window_t *pWnd, int query, va_list args )



More information about the vlc-commits mailing list