[vlc-commits] modules: move assertion for additional coverage
Lyndon Brown
git at videolan.org
Fri Sep 18 21:01:48 CEST 2020
vlc | branch: master | Lyndon Brown <jnqnfe at gmail.com> | Thu Sep 17 22:36:19 2020 +0100| [8609c2cf70565a94141d9988f75b256c5303de2f] | committer: Alexandre Janniaux
modules: move assertion for additional coverage
...thus we get an assert failure rather than null dereference wrt. to the
conditional block at the start.
Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8609c2cf70565a94141d9988f75b256c5303de2f
---
src/modules/modules.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 4334afdcbd..ee47ec30c3 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -358,23 +358,22 @@ module_config_t *module_config_get( const module_t *module, unsigned *restrict p
{
const vlc_plugin_t *plugin = module->plugin;
+ assert( psize != NULL );
+ *psize = 0;
+
if (plugin->module != module)
{ /* For backward compatibility, pretend non-first modules have no
* configuration items. */
- *psize = 0;
return NULL;
}
- unsigned i,j;
size_t size = plugin->conf.size;
module_config_t *config = vlc_alloc( size, sizeof( *config ) );
- assert( psize != NULL );
- *psize = 0;
-
if( !config )
return NULL;
+ unsigned i, j;
for( i = 0, j = 0; i < size; i++ )
{
const module_config_t *item = plugin->conf.items + i;
More information about the vlc-commits
mailing list