On Wed, Feb 19, 2025 at 22:27:08 +0530, Harikumar Rajkumar wrote:
> From: Chun Feng Wu <[email protected]>
>
> Introduce throttle filter along with corresponding operations.
>
> * Define new struct 'virDomainThrottleFilterDef' and corresponding destructor
> * Update _virDomainDiskDef to include virDomainThrottleFilterDef
> * Support throttle filter "Parse" and "Format" for operations between DOM XML
> and structs. Note, this commit just contains parse/format of group name for
> throttle filter in domain_conf.c, there is other commit to handle throttle
> filter nodename parse/format between throttlefilter and diskPrivateData for
> statusxml in qemu_domain.c when processing qemuDomainDiskPrivate and
> qemuDomainDiskPrivate
>
> Signed-off-by: Chun Feng Wu <[email protected]>
>
> * Error handling for null throttle group.
> * Update of code documentation comments.
> * Apply suggested coding style changes.
>
> Signed-off-by: Harikumar Rajkumar <[email protected]>
> ---
> src/conf/domain_conf.c | 99 +++++++++++++++++++++++++++++++++++++++++
> src/conf/domain_conf.h | 20 +++++++++
> src/conf/virconftypes.h | 2 +
> 3 files changed, 121 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 40f4bf6f49..303aa7d1ae 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3825,6 +3825,16 @@
> virDomainThrottleGroupDefArrayFree(virDomainThrottleGroupDef **def,
> }
>
>
> +void
> +virDomainThrottleFilterDefClear(virDomainThrottleFilterDef *def)
> +{
> + if (!def)
> + return;
> + g_free(def->group_name);
> + g_free(def->nodename);
> +}
This function is registered as the automatic cleanup helper for
virDomainThrottleFilterDef thus must also free the whole object, in
which case it should be renamed with ...Free suffix.
> +
> +
> void
> virDomainResourceDefFree(virDomainResourceDef *resource)
> {
[...]
> @@ -552,6 +561,9 @@ struct _virDomainDiskDef {
>
> virDomainBlockIoTuneInfo blkdeviotune;
>
> + size_t nthrottlefilters;
> + virDomainThrottleFilterDef **throttlefilters;
Corresponding update of virDomainDiskDefFree is missing so the above
pointer and each struct in it is leaked.