mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
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: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
35fe8d97c0
commit
c86c3c324f
@ -10221,6 +10221,8 @@ virDomainChrGetDomainPtrs(virDomainDefPtr vmdef,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
|
||||
*arrPtr = NULL;
|
||||
*cntPtr = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user