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

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


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

modules: restore empty strings in cached choices list

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

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

diff --git a/src/modules/cache.c b/src/modules/cache.c
index 97e4201..ed32619 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.psz[i] == NULL /* NULL -> empty string */
+         && (cfg->list.psz[i] = calloc (1, 1)) == NULL)
+            goto error;
+    }
 
     return 0;
 error:



More information about the vlc-commits mailing list