[vlc-commits] [Git][videolan/vlc][master] css_parser: check allocation errors
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jun 13 13:37:27 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3a90548b by Steve Lhomme at 2025-06-13T13:13:24+00:00
css_parser: check allocation errors
- - - - -
1 changed file:
- modules/codec/webvtt/css_parser.c
Changes:
=====================================
modules/codec/webvtt/css_parser.c
=====================================
@@ -114,7 +114,7 @@ static void vlc_css_expression_Debug( const vlc_css_expr_t *p_expr, int depth )
vlc_css_expr_t * vlc_css_expression_New( vlc_css_term_t term )
{
vlc_css_expr_t *p_expr = calloc(1, sizeof(*p_expr));
- if(!vlc_css_expression_AddTerm( p_expr, 0, term ))
+ if(p_expr && !vlc_css_expression_AddTerm( p_expr, 0, term ))
{
free(p_expr);
p_expr = NULL;
@@ -150,7 +150,15 @@ static void vlc_css_declarations_Debug( const vlc_css_declaration_t *p_decl, int
vlc_css_declaration_t * vlc_css_declaration_New( const char *psz )
{
vlc_css_declaration_t *p_decl = calloc(1, sizeof(*p_decl));
- p_decl->psz_property = strdup(psz);
+ if (likely(p_decl != NULL))
+ {
+ p_decl->psz_property = strdup(psz);
+ if (unlikely( p_decl->psz_property == NULL ))
+ {
+ free(p_decl);
+ p_decl = NULL;
+ }
+ }
return p_decl;
}
@@ -194,6 +202,8 @@ static void vlc_css_selectors_Debug( const vlc_css_selector_t *p_sel, int depth
vlc_css_selector_t * vlc_css_selector_New( int type, const char *psz )
{
vlc_css_selector_t *p_sel = calloc(1, sizeof(*p_sel));
+ if (unlikely(p_sel == NULL))
+ return NULL;
p_sel->psz_name = strdup(psz);
p_sel->type = type;
p_sel->combinator = RELATION_SELF;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3a90548bc1c85a18d81f14f3ce5aedc5af943b6a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3a90548bc1c85a18d81f14f3ce5aedc5af943b6a
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list