]> git.ipfire.org Git - thirdparty/qemu.git/commit
multi-process: Initialize variables declared with g_auto*
authorZenghui Yu <yuzenghui@huawei.com>
Fri, 12 Mar 2021 11:21:43 +0000 (19:21 +0800)
committerMichael Roth <michael.roth@amd.com>
Wed, 13 Oct 2021 16:13:38 +0000 (11:13 -0500)
commit1513997aa2aac392d8a2e020feddd26f0f1fc4d3
treee4df2fb3f0836fd0dc7a40534765765a6d6d59b9
parent609d7596524ab204ccd71ef42c9eee4c7c338ea4
multi-process: Initialize variables declared with g_auto*

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>
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: 20210312112143.1369-1-yuzenghui@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit d90226808b5b1b30b07968e94d8f74bf8804fc89)
Signed-off-by: Michael Roth <michael.roth@amd.com>
hw/remote/memory.c
hw/remote/proxy.c