lkml.org 
[lkml]   [2021]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan
Date
On 20.11.21 07:53, Ahmad Fatoum wrote:
>> + snd_ctx_arr[total_counter] = snd_ctx;
>
> You are storing at snd_ctx_arr[num_fd] each time, so you will leak
> all context, except for the last one.

Oh, it's more subtle than that. total_counter is of course incremented
every time in the previous loop, so you will have num_fd times NULL
(from static initialization) then a pointer to an allocation and so on.
That works by the looks of it, but looks quite strange.


--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

\
 
 \ /
  Last update: 2021-11-20 08:09    [W:0.304 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site