[LTP] [PATCH] tst_af_alg: Fix control buffer memory leak
Petr Vorel
pvorel@suse.cz
Fri Sep 11 11:43:45 CEST 2026
Hi Andrea,
> The ancillary control buffer allocated in tst_alg_sendmsg() is never
> freed after sendmsg(), leaking memory on repeated calls in the same
> process.
> Free the buffer once sendmsg() completes.
Good catch, thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
> Fixes: 3cbb963abb9e ("lib/tst_af_alg: add tst_alg_sendmsg()")
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> lib/tst_af_alg.c | 2 ++
> 1 file changed, 2 insertions(+)
> diff --git a/lib/tst_af_alg.c b/lib/tst_af_alg.c
> index 93757278f..10fb42da5 100644
> --- a/lib/tst_af_alg.c
> +++ b/lib/tst_af_alg.c
> @@ -249,4 +249,6 @@ void tst_alg_sendmsg(int reqfd, const void *data, size_t datalen,
> }
> SAFE_SENDMSG(datalen, reqfd, &msg, params->msg_flags);
> +
> + free(control);
> }
More information about the ltp
mailing list