[libvirt PATCH] util: Fix memory leak when clearing Open vSwitch QoS

Jiri Denemark posted 1 patch 2 years, 8 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ca1c49e049f8903f99cb0123da67e483759eec54.1628787548.git.jdenemar@redhat.com
src/util/virnetdevopenvswitch.c | 1 -
1 file changed, 1 deletion(-)
[libvirt PATCH] util: Fix memory leak when clearing Open vSwitch QoS
Posted by Jiri Denemark 2 years, 8 months ago
No need to overwrite vmid_ex_id with a pointer to another copy of the
same string when the original is still alive.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/util/virnetdevopenvswitch.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 7a64a8dbe6..f6a8ed4a31 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -824,7 +824,6 @@ virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
     /* find queue */
     virCommandFree(cmd);
     cmd = virNetDevOpenvswitchCreateCmd();
-    vmid_ex_id = g_strdup_printf("external-ids:vm-id=\"%s\"", vmuuidstr);
     virCommandAddArgList(cmd, "--no-heading", "--columns=_uuid", "find", "queue", vmid_ex_id, NULL);
     virCommandSetOutputBuffer(cmd, &queue_uuid);
     if (virCommandRun(cmd, NULL) < 0) {
-- 
2.32.0

Re: [libvirt PATCH] util: Fix memory leak when clearing Open vSwitch QoS
Posted by Jano Tomko 2 years, 8 months ago
On a %A in %Y, Jiri Denemark wrote:
> No need to overwrite vmid_ex_id with a pointer to another copy of the
> same string when the original is still alive.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/util/virnetdevopenvswitch.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
> index 7a64a8dbe6..f6a8ed4a31 100644
> --- a/src/util/virnetdevopenvswitch.c
> +++ b/src/util/virnetdevopenvswitch.c
> @@ -824,7 +824,6 @@ virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
>      /* find queue */
>      virCommandFree(cmd);
>      cmd = virNetDevOpenvswitchCreateCmd();
> -    vmid_ex_id = g_strdup_printf("external-ids:vm-id=\"%s\"", vmuuidstr);
>      virCommandAddArgList(cmd, "--no-heading", "--columns=_uuid", "find", "queue", vmid_ex_id, NULL);
>      virCommandSetOutputBuffer(cmd, &queue_uuid);
>      if (virCommandRun(cmd, NULL) < 0) {
> 

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

Jano