On 5/6/25 12:29, liu.son...@zte.com.cn wrote:
> From: QiangWei Zhang <zhang.qiang...@zte.com.cn>
> 
> Variable &apos;master&apos; needs to be free because it will be reassigned in
> virNetDevOpenvswitchInterfaceGetMaster().
> 
> The leaked stack:
> Direct leak of 11 byte(s) in 1 object(s) allocated from:
> #0 0x7f7dad8ba6df in __interceptor_malloc (/lib64/libasan.so.8+0xba6df)
> #1 0x7f7dad715728 in g_malloc (/lib64/libglib-2.0.so.0+0x60728)
> #2 0x7f7dad72d8b2 in g_strdup (/lib64/libglib-2.0.so.0+0x788b2)
> #3 0x7f7dacb63088 in g_strdup_inline 
> /usr/include/glib-2.0/glib/gstrfuncs.h:321
> #4 0x7f7dacb63088 in virNetDevGetName ../src/util/virnetdev.c:823
> #5 0x7f7dacb63886 in virNetDevGetMaster ../src/util/virnetdev.c:909
> #6 0x7f7dacb90288 in virNetDevTapReattachBridge ../src/util/virnetdevtap.c:527
> #7 0x7f7dacd5cd67 in virDomainNetNotifyActualDevice 
> ../src/conf/domain_conf.c:30505
> #8 0x7f7da3a10bc3 in qemuProcessNotifyNets ../src/qemu/qemu_process.c:3290
> #9 0x7f7da3a375c6 in qemuProcessReconnect ../src/qemu/qemu_process.c:9211
> #10 0x7f7dacc0cc53 in virThreadHelper ../src/util/virthread.c:256
> #11 0x7f7dac2875d4 in start_thread (/lib64/libc.so.6+0x875d4)
> #12 0x7f7dac3091bb in __GI___clone3 (/lib64/libc.so.6+0x1091bb)
> 
> Fixes: de938b92c9d3a47647164aa643c20d2fc96cd2bc
> Signed-off-by: QiangWei Zhang <zhang.qiang...@zte.com.cn>
> Reviewed-by: Peter Krempa <pkre...@redhat.com>
> ---
> src/util/virnetdevtap.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
> index 1dc77f0f5c..f26afb2ce0 100644
> --- a/src/util/virnetdevtap.c
> +++ b/src/util/virnetdevtap.c
> @@ -541,6 +541,9 @@ virNetDevTapReattachBridge(const char *tapname,
> /* IFLA_MASTER for a tap on an OVS switch is always "ovs-system" */
> if (STREQ_NULLABLE(master, "ovs-system")) {
> useOVS = true;
> +
> +        /* master needs to be released here because it will be reassigned */
> +        g_clear_pointer(&master, g_free);
> if (virNetDevOpenvswitchInterfaceGetMaster(tapname, &master) < 0)
> return -1;
> }
> --
> 2.27.0
> 

This patch wouldn't apply cleanly. Can you resend please? From the diff
I can see what you're trying to achieve and it makes sense.

Michal

Reply via email to