Commit 1497a8a8 authored by Rémi Duraffort's avatar Rémi Duraffort

Fix one potential memleak (CID 195)

parent f2143d06
...@@ -453,10 +453,6 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) ...@@ -453,10 +453,6 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
{ {
const char *domain = va_arg (ap, const char *); const char *domain = va_arg (ap, const char *);
size_t len = va_arg (ap, size_t); size_t len = va_arg (ap, size_t);
char **dtext = malloc (sizeof (char *) * (len + 1));
if (dtext == NULL)
break;
/* Copy values */ /* Copy values */
if (IsConfigIntegerType (item->i_type)) if (IsConfigIntegerType (item->i_type))
...@@ -509,19 +505,20 @@ int vlc_config_set (module_config_t *restrict item, int id, ...) ...@@ -509,19 +505,20 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
const char *const *text = va_arg (ap, const char *const *); const char *const *text = va_arg (ap, const char *const *);
if (text != NULL) if (text != NULL)
{
char **dtext = malloc (sizeof (char *) * (len + 1));
if( dtext != NULL )
{ {
for (size_t i = 0; i < len; i++) for (size_t i = 0; i < len; i++)
dtext[i] = dtext[i] = text[i] ?
text[i] ? strdup (dgettext (domain, text[i])) : NULL; strdup( dgettext( domain, text[i] ) ) :
NULL;
dtext[len] = NULL; dtext[len] = NULL;
}
item->ppsz_list_text = dtext; item->ppsz_list_text = dtext;
} }
else else
{
free (dtext);
item->ppsz_list_text = NULL; item->ppsz_list_text = NULL;
}
item->i_list = len; item->i_list = len;
item->pf_update_list = va_arg (ap, vlc_callback_t); item->pf_update_list = va_arg (ap, vlc_callback_t);
......
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