Commit e8e468fb authored by Francois Cartegnie's avatar Francois Cartegnie

modules: cache: fix leaking path on error (cid #1048948)

parent f9fcc8bc
...@@ -362,6 +362,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) ...@@ -362,6 +362,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
module_cache_t *cache = NULL; module_cache_t *cache = NULL;
size_t count = 0; size_t count = 0;
char *path = NULL;
for (;;) for (;;)
{ {
...@@ -373,7 +374,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) ...@@ -373,7 +374,6 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
goto error; goto error;
} }
char *path;
struct stat st; struct stat st;
/* Load common info */ /* Load common info */
...@@ -385,6 +385,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) ...@@ -385,6 +385,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
CacheAdd (&cache, &count, path, &st, module); CacheAdd (&cache, &count, path, &st, module);
free (path); free (path);
path = NULL;
/* TODO: deal with errors */ /* TODO: deal with errors */
} }
...@@ -394,6 +395,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r ) ...@@ -394,6 +395,7 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
return count; return count;
error: error:
free( path );
if (ferror (file)) if (ferror (file))
msg_Err(p_this, "plugins cache read error: %s", vlc_strerror_c(errno)); msg_Err(p_this, "plugins cache read error: %s", vlc_strerror_c(errno));
msg_Warn( p_this, "plugins cache not loaded (corrupted)" ); msg_Warn( p_this, "plugins cache not loaded (corrupted)" );
......
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