[vlmc-devel] [PATCH 2/2] Use delete[]

Hugo Beauzée-Luyssen hugo at beauzee.fr
Sat Apr 2 11:39:05 CEST 2016


On 04/02/2016 07:45 AM, Yikai Lu wrote:
> Since buff is created by new uchar[], delete[] should be used to delete it completely.
> ---
>   src/Workflow/AudioClipWorkflow.cpp | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/Workflow/AudioClipWorkflow.cpp b/src/Workflow/AudioClipWorkflow.cpp
> index 3b08877..c119c29 100644
> --- a/src/Workflow/AudioClipWorkflow.cpp
> +++ b/src/Workflow/AudioClipWorkflow.cpp
> @@ -52,13 +52,13 @@ AudioClipWorkflow::releasePrealocated()
>       while ( m_availableBuffers.isEmpty() == false )
>       {
>           Workflow::AudioSample *as = m_availableBuffers.takeFirst();
> -        delete as->buff;
> +        delete[] as->buff;
>           delete as;
>       }
>       while ( m_computedBuffers.isEmpty() == false )
>       {
>           Workflow::AudioSample *as = m_computedBuffers.takeFirst();
> -        delete as->buff;
> +        delete[] as->buff;
>           delete as;
>       }
>   }
>
It might be time we start using some smart pointers for the buffers as 
well, we shouldn't have to deal with this manually IMHO


More information about the Vlmc-devel mailing list