[vlc-commits] commit: lua_timers: fix timers. ( Rémi Duraffort )
git at videolan.org
git at videolan.org
Sun Nov 7 20:16:43 CET 2010
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Nov 7 20:16:01 2010 +0100| [bcf3cce0e49d2c6ab934aada2ffa7bc4f707076a] | committer: Rémi Duraffort
lua_timers: fix timers.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcf3cce0e49d2c6ab934aada2ffa7bc4f707076a
---
modules/misc/lua/libs/misc.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index 42b0d56..b0a6695 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -309,17 +309,21 @@ static int vlclua_timer_delete( lua_State *L )
vlc_timer_destroy( (*pp_timer)->timer );
free( (*pp_timer)->psz_callback );
+ free( (*pp_timer) );
return 0;
}
static int vlclua_timer_create( lua_State *L )
{
- vlclua_timer_t *p_timer = malloc( sizeof( vlclua_timer_t ) );
if( !lua_isstring( L, 1 ) )
return luaL_error( L, "timer(function_name)" );
+ vlclua_timer_t *p_timer = malloc( sizeof( vlclua_timer_t ) );
if( vlc_timer_create( &p_timer->timer, vlclua_timer_callback, p_timer ) )
+ {
+ free( p_timer );
return luaL_error( L, "Cannot initialize the timer" );
+ }
p_timer->L = L;
p_timer->psz_callback = strdup( luaL_checkstring( L, 1 ) );
More information about the vlc-commits
mailing list