qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] multi-process: Initialize variables declared with g_auto*


From: Zenghui Yu
Subject: Re: [PATCH v3] multi-process: Initialize variables declared with g_auto*
Date: Tue, 6 Apr 2021 22:00:03 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

[+Stefan]

On 2021/3/12 19:21, Zenghui Yu wrote:
Quote docs/devel/style.rst (section "Automatic memory deallocation"):

* Variables declared with g_auto* MUST always be initialized,
   otherwise the cleanup function will use uninitialized stack memory

Initialize @name properly to get rid of the compilation error (using
gcc-7.3.0 on CentOS):

../hw/remote/proxy.c: In function 'pci_proxy_dev_realize':
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'name' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
    g_free (*pp);
    ^~~~~~~~~~~~
../hw/remote/proxy.c:350:30: note: 'name' was declared here
              g_autofree char *name;
                               ^~~~

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Message-Id: <20210312112143.1369-1-yuzenghui@huawei.com>

Ping for 6.0, thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]