On 29/07/13 14:36, Martin Storsjö wrote:
> This avoids crashes and leaks if the realloc fails. The failure
> isn't signalled to the caller in any way, though.
> ---
>  libavformat/cutils.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/cutils.c b/libavformat/cutils.c
> index f58e152..75dc150 100644
> --- a/libavformat/cutils.c
> +++ b/libavformat/cutils.c
> @@ -36,6 +36,8 @@ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, 
> intptr_t elem)
>          else
>              nb_alloc = nb * 2;
>          tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
> +        if (!tab)
> +            return;
>          *tab_ptr = tab;
>      }
>      tab[nb++] = elem;

We should fix it properly later, this bandaid is fine for now IMHO.

lu


_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to