]> git.sesse.net Git - vlc/commitdiff
modules: restore empty strings in cached choices list
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 19 Jan 2013 18:25:30 +0000 (20:25 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 19 Jan 2013 18:36:06 +0000 (20:36 +0200)
src/modules/cache.c

index 97e42018b0cf7669dce89571c8a9f0be776dbebb..d7aae1dd882fb320605e7f90935dc53aabb944f5 100644 (file)
@@ -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: