[vlc-commits] lua/vlc: vlc_sd_probe_Open: fix memory-leak
Filip Roséen
git at videolan.org
Fri Nov 18 09:04:06 CET 2016
vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Nov 18 09:02:30 2016 +0100| [7579cb0250ac4cc7e441f11d6c9b354197b1a58e] | committer: Pierre Ynard
lua/vlc: vlc_sd_probe_Open: fix memory-leak
vlc_dictionary_all_keys requires the caller to not only release the
returned value, but also the entities this value refers to; these
changes fixes a memory-leak due to not doing the latter.
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7579cb0250ac4cc7e441f11d6c9b354197b1a58e
---
modules/lua/vlc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 0a1cc70..70af88e 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -654,12 +654,16 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
char **names = vlc_dictionary_all_keys( &name_d );
if( names != NULL )
{
- for( char **name = names; *name != NULL; name++ )
+ for( char **name = names; *name; ++name )
{
r = vlclua_probe_sd( obj, *name );
if( r != VLC_PROBE_CONTINUE )
break;
}
+
+ for( char **name = names; *name; ++name )
+ free( *name );
+
free( names );
}
vlc_dictionary_clear( &name_d, NULL, NULL );
More information about the vlc-commits
mailing list