[libvirt PATCH] conf: Avoid double free in virDomainEventTunableNew callers

Jiri Denemark posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3e48b95da08a2ed9452865b6759430ab460426d1.1667398460.git.jdenemar@redhat.com
src/conf/domain_event.c | 1 +
1 file changed, 1 insertion(+)
[libvirt PATCH] conf: Avoid double free in virDomainEventTunableNew callers
Posted by Jiri Denemark 1 year, 4 months ago
virDomainEventTunableNew is supposed to consume and free @params, but it
failed to always set @params to NULL to make sure the caller doesn't try
to free the same memory again.

Fixes: d95c79fbd00dc597b607b130d95c258b6cf31690
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/conf/domain_event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 97d58c2521..7e9bd08381 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1515,6 +1515,7 @@ virDomainEventTunableNew(int id,
 
  error:
     virTypedParamsFree(*params, nparams);
+    *params = NULL;
     return NULL;
 }
 
-- 
2.38.1
Re: [libvirt PATCH] conf: Avoid double free in virDomainEventTunableNew callers
Posted by Ján Tomko 1 year, 4 months ago
On a Wednesday in 2022, Jiri Denemark wrote:
>virDomainEventTunableNew is supposed to consume and free @params, but it
>failed to always set @params to NULL to make sure the caller doesn't try
>to free the same memory again.
>
>Fixes: d95c79fbd00dc597b607b130d95c258b6cf31690
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/conf/domain_event.c | 1 +
> 1 file changed, 1 insertion(+)
>

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

Jano