[vlc-commits] [Git][videolan/vlc][master] 3 commits: preparser_serializer: free extra languages correctly
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat May 9 16:54:02 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
48c74641 by Marvin Scholz at 2026-05-09T18:09:02+02:00
preparser_serializer: free extra languages correctly
The vlc_vector_clear will just clear the vector but not the pointees
of the extra_languages_t members.
- - - - -
d628fd81 by Marvin Scholz at 2026-05-09T18:09:02+02:00
preparser_serializer: handle vlc_vector_push error
While the vector size is checked later, so an error would be caught
there too, the missing check here meant that if the vector push failed,
the extra_languages_t member pointees would be leaked.
Fix Coverity ID 1692758
Fix Coverity ID 1692726
- - - - -
33f58d2c by Marvin Scholz at 2026-05-09T18:09:02+02:00
preparser_serializer: properly free es_format_t
If pushing the item fails, or another error happened before,
the es_format_t would be leaked.
- - - - -
1 changed file:
- modules/misc/preparser_serializer/json/fromjson.c
Changes:
=====================================
modules/misc/preparser_serializer/json/fromjson.c
=====================================
@@ -57,7 +57,7 @@ static inline vlc_fourcc_t vlc_fourcc_from_char(const char *fourcc)
return VLC_FOURCC(f[0], f[1], f[2], f[3]);
}
-/* Get value in `obj` with the key `name` and check if it's a number and if
+/* Get value in `obj` with the key `name` and check if it's a number and if
* it's between `min` and `max`. */
static inline bool json_object_to_number(const struct json_object *obj,
const char *name, double *number,
@@ -787,13 +787,25 @@ static void fromJSON_es_format(struct serdes_sys *sys,
json_object_to_string(subobj, "psz_language", &el.psz_language, &err);
json_object_to_string(subobj, "psz_description", &el.psz_description,
&err);
- vlc_vector_push(&el_vec, el);
+
+ if (!err) {
+ err = !vlc_vector_push(&el_vec, el);
+ }
+ if (err) {
+ free(el.psz_language);
+ free(el.psz_description);
+ }
}
if (elvec_size == el_vec.size) {
es->p_extra_languages = el_vec.data;
es->i_extra_languages = el_vec.size;
vlc_vector_init(&el_vec);
} else {
+ extra_languages_t *el;
+ vlc_vector_foreach_ref(el, &el_vec) {
+ free(el->psz_language);
+ free(el->psz_description);
+ }
vlc_vector_clear(&el_vec);
err = true;
}
@@ -1001,7 +1013,11 @@ static void fromJSON_input_item(struct serdes_sys *sys,
struct input_item_es item_es = {0};
fromJSON_input_item_es(sys, &v->object, &item_es, &err);
if (!err) {
- vlc_vector_push(&i->es_vec, item_es);
+ err = !vlc_vector_push(&i->es_vec, item_es);
+ }
+
+ if (err) {
+ es_format_Clean(&item_es.es);
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/638e26bce1404c216febc411d5b8f0cdeb115f6f...33f58d2cc74c87068809a79dc62c09b8da76e4be
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/638e26bce1404c216febc411d5b8f0cdeb115f6f...33f58d2cc74c87068809a79dc62c09b8da76e4be
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list