[pve-devel] [PATCH librados2-perl 1/6] mon_command: free outs buffer
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Feb 21 16:35:31 CET 2022
On 18.02.22 12:38, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
>
> thanks @Dominik who realized that we did not free this buffer in all
> situations.
>
note that the status string is normally only allocated in the error case,
where we freed it already, so actual impact shouldn't be that big; still
definitively more correct this way ;)
> RADOS.xs | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/RADOS.xs b/RADOS.xs
> index 7eca024..1eb0b5a 100644
> --- a/RADOS.xs
> +++ b/RADOS.xs
> @@ -145,6 +145,10 @@ CODE:
> RETVAL = newSVpv(outbuf, outbuflen);
>
> rados_buffer_free(outbuf);
> +
> + if (outs != NULL) {
fyi: I made all calls to rados_buffer_free unconditional as the code there
checks already for null-ness (not that it'd matter much, free(NULL) is a no-op)
and it makes librados' built-in tracing more complete.
> + rados_buffer_free(outs);
fyi: above had a tab in a file that uses space only indentation.
> + }
> }
> OUTPUT: RETVAL
>
applied, thanks!
More information about the pve-devel
mailing list