[PATCH pushed] qemumonitorjsontes: Properly free blockstats

Peter Krempa via Devel posted 1 patch 4 days, 12 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/69e5ad478e87bb55fed82b618d8e7b56d6a6c35b.1761064456.git.pkrempa@redhat.com
tests/qemumonitorjsontest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH pushed] qemumonitorjsontes: Properly free blockstats
Posted by Peter Krempa via Devel 4 days, 12 hours ago
From: Peter Krempa <pkrempa@redhat.com>

In the patch converting block stats to objects in 58aa005f3e9 I forgot
to change the allocation of the hash table in qemumonitorjsontest which
doesn't use the wrapper. This problem didn't manifest itself with newer
glib versions.

Use 'g_object_unref' instead of 'g_free'.

Fixes: 58aa005f3e9
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemumonitorjsontest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index a229a89860..6129dde449 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1446,7 +1446,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
 {
     const testGenericData *data = opaque;
     virDomainXMLOption *xmlopt = data->xmlopt;
-    g_autoptr(GHashTable) blockstats = virHashNew(g_free);
+    g_autoptr(GHashTable) blockstats = virHashNew(g_object_unref);
     qemuBlockStats *stats;
     g_autoptr(qemuMonitorTest) test = NULL;

-- 
2.51.0
Re: [PATCH pushed] qemumonitorjsontes: Properly free blockstats
Posted by Jiri Denemark via Devel 4 days, 11 hours ago
On Tue, Oct 21, 2025 at 18:36:08 +0200, Peter Krempa wrote:
> From: Peter Krempa <pkrempa@redhat.com>
> 
> In the patch converting block stats to objects in 58aa005f3e9 I forgot
> to change the allocation of the hash table in qemumonitorjsontest which
> doesn't use the wrapper. This problem didn't manifest itself with newer
> glib versions.
> 
> Use 'g_object_unref' instead of 'g_free'.
> 
> Fixes: 58aa005f3e9
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tests/qemumonitorjsontest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
> index a229a89860..6129dde449 100644
> --- a/tests/qemumonitorjsontest.c
> +++ b/tests/qemumonitorjsontest.c
> @@ -1446,7 +1446,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
>  {
>      const testGenericData *data = opaque;
>      virDomainXMLOption *xmlopt = data->xmlopt;
> -    g_autoptr(GHashTable) blockstats = virHashNew(g_free);
> +    g_autoptr(GHashTable) blockstats = virHashNew(g_object_unref);
>      qemuBlockStats *stats;
>      g_autoptr(qemuMonitorTest) test = NULL;

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Re: [PATCH pushed] qemumonitorjsontes: Properly free blockstats
Posted by Ján Tomko via Devel 3 days, 23 hours ago
On a Tuesday in 2025, Jiri Denemark via Devel wrote:
>On Tue, Oct 21, 2025 at 18:36:08 +0200, Peter Krempa wrote:
>> From: Peter Krempa <pkrempa@redhat.com>
>>
>> In the patch converting block stats to objects in 58aa005f3e9 I forgot
>> to change the allocation of the hash table in qemumonitorjsontest which
>> doesn't use the wrapper. This problem didn't manifest itself with newer
>> glib versions.
>>
>> Use 'g_object_unref' instead of 'g_free'.
>>
>> Fixes: 58aa005f3e9
>> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>> ---
>>  tests/qemumonitorjsontest.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
>> index a229a89860..6129dde449 100644
>> --- a/tests/qemumonitorjsontest.c
>> +++ b/tests/qemumonitorjsontest.c
>> @@ -1446,7 +1446,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
>>  {
>>      const testGenericData *data = opaque;
>>      virDomainXMLOption *xmlopt = data->xmlopt;
>> -    g_autoptr(GHashTable) blockstats = virHashNew(g_free);
>> +    g_autoptr(GHashTable) blockstats = virHashNew(g_object_unref);
>>      qemuBlockStats *stats;
>>      g_autoptr(qemuMonitorTest) test = NULL;
>
>Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano