[vlc-commits] modules: restore empty strings in cached choices list

Rémi Denis-Courmont git at videolan.org
Sat Jan 19 19:36:14 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 19 20:25:30 2013 +0200| [39af5f93f77ab1854a08df3a078814f3b6948e14] | committer: Rémi Denis-Courmont

modules: restore empty strings in cached choices list

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

 src/modules/cache.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/modules/cache.c b/src/modules/cache.c
index 97e4201..d7aae1d 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -135,7 +135,12 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
         else /* TODO: fix config_GetPszChoices() instead of this hack: */
             LOAD_IMMEDIATE(cfg->list.psz_cb);
         for (unsigned i = 0; i < cfg->list_count; i++)
+        {
             LOAD_STRING (cfg->list.psz[i]);
+            if (cfg->list.psz[i] == NULL /* NULL -> empty string */
+             && (cfg->list.psz[i] = calloc (1, 1)) == NULL)
+                goto error;
+        }
     }
     else
     {
@@ -153,7 +158,12 @@ static int CacheLoadConfig (module_config_t *cfg, FILE *file)
     }
     cfg->list_text = xmalloc (cfg->list_count * sizeof (char *));
     for (unsigned i = 0; i < cfg->list_count; i++)
+    {
         LOAD_STRING (cfg->list_text[i]);
+        if (cfg->list_text[i] == NULL /* NULL -> empty string */
+         && (cfg->list_text[i] = calloc (1, 1)) == NULL)
+            goto error;
+    }
 
     return 0;
 error:



More information about the vlc-commits mailing list