[vlmc-devel] [PATCH 2/2] Use delete[]
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Sat Apr 2 11:27:39 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;
> }
> }
>
Good point.
It's interesting that asan didn't catch those when I ran it... We
probably need to double check if those buffers were released at all...
More information about the Vlmc-devel
mailing list