[vlc-devel] [PATCH] transform: inline error handling

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 8 06:40:11 UTC 2021


On 2021-01-07 16:51, Alexandre Janniaux wrote:
> ...and remove useless error label. The resources are released by the
> vlc_objres mechanism already.

Did you check all possible ways to create filters do release resources 
on Open error ? If so this should be done in other filters as well.

> ---
>   modules/video_filter/transform.c | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
> index 473bd4f9fa..96397d0f7a 100644
> --- a/modules/video_filter/transform.c
> +++ b/modules/video_filter/transform.c
> @@ -348,7 +348,7 @@ static int Open(filter_t *filter)
>           default:
>               msg_Err(filter, "Unsupported pixel size %u (chroma %4.4s)",
>                       chroma->pixel_size, (char *)&src->i_chroma);
> -            goto error;
> +            return VLC_EGENERIC;
>       }
>   
>       for (unsigned i = 1; i < PICTURE_PLANE_MAX; i++)
> @@ -367,7 +367,7 @@ static int Open(filter_t *filter)
>                        != chroma->p[i].h.num * chroma->p[i].w.den) {
>                           msg_Err(filter, "Format rotation not possible "
>                                   "(chroma %4.4s)", (char *)&src->i_chroma);
> -                        goto error;
> +                        return VLC_EGENERIC;
>                       }
>               }
>           }
> @@ -393,7 +393,7 @@ static int Open(filter_t *filter)
>            dst->i_y_offset       != src_trans.i_y_offset)) {
>   
>               msg_Err(filter, "Format change is not allowed");
> -            goto error;
> +            return VLC_EGENERIC;
>       }
>       else if(filter->b_allow_fmt_out_change) {
>   
> @@ -414,7 +414,7 @@ static int Open(filter_t *filter)
>               if (dsc_is_rotated(dsc)) {
>                   msg_Err(filter, "Format rotation not possible (chroma %4.4s)",
>                           (char *)&src->i_chroma);
> -                goto error;
> +                return VLC_EGENERIC;
>               }
>               /* fallthrough */
>           case VLC_CODEC_YUYV:
> @@ -423,7 +423,7 @@ static int Open(filter_t *filter)
>               break;
>           case VLC_CODEC_NV12:
>           case VLC_CODEC_NV21:
> -            goto error;
> +            return VLC_EGENERIC;
>       }
>   
>       static const struct vlc_filter_operations filter_ops =
> @@ -434,7 +434,4 @@ static int Open(filter_t *filter)
>       filter->ops = &filter_ops;
>       filter->p_sys           = sys;
>       return VLC_SUCCESS;
> -error:
> -    vlc_obj_free(VLC_OBJECT(filter), sys);
> -    return VLC_EGENERIC;
>   }
> -- 
> 2.30.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list