[vlc-devel] [PATCH] correctly handle realloc() failure

Rémi Denis-Courmont rdenis at simphalempin.com
Thu Sep 18 11:50:52 CEST 2008


On Thu, 18 Sep 2008 10:10:36 +0200, Justus Piater <Justus-bulk at Piater.name>
wrote:
> From: Justus Piater <Justus-dev at Piater.name>

Acked-by: Remi Denis-Courmont <rdenis at simphalempin.com>

(although I would rather we switch to a double-linked list).

> ---
>  src/misc/objects.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/misc/objects.c b/src/misc/objects.c
> index 35301a9..55744a1 100644
> --- a/src/misc/objects.c
> +++ b/src/misc/objects.c
> @@ -803,8 +803,11 @@ static void vlc_object_detach_unlocked (vlc_object_t
> *p_this)
> 
>      if( priv->i_children )
>      {
> -        priv->pp_children = (vlc_object_t **)realloc( priv->pp_children,
> -                               priv->i_children * sizeof(vlc_object_t *)
> );
> +        vlc_object_t **pp_children = (vlc_object_t **)
> +            realloc( priv->pp_children,
> +                     priv->i_children * sizeof(vlc_object_t *) );
> +        if( pp_children )
> +            priv->pp_children = pp_children;
>      }
>      else
>      {
> --
> 1.5.6.5
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list