提交 c86c3c32 编写于 作者: E Eric Blake

build: avoid uninitialized use warning

Otherwise, with new enough gcc compiling at -O2, the build fails with:
../../src/conf/domain_conf.c: In function ‘virDomainDeviceDefPostParse’:
../../src/conf/domain_conf.c:2821:29: error: ‘cnt’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
             for (i = 0; i < *cnt; i++) {
                             ^
../../src/conf/domain_conf.c:2795:20: note: ‘cnt’ was declared here
         size_t i, *cnt;
                    ^
../../src/conf/domain_conf.c:2794:30: error: ‘arrPtr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         virDomainChrDefPtr **arrPtr;
                              ^

* src/conf/domain_conf.c (virDomainChrGetDomainPtrs): Always
assign into output parameters.
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 35fe8d97
......@@ -10221,6 +10221,8 @@ virDomainChrGetDomainPtrs(virDomainDefPtr vmdef,
break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
*arrPtr = NULL;
*cntPtr = NULL;
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册