mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
virXMLPropUInt: Always initialize @result
Compilers aren't able to see whether @result is set or not and thus don't warn of a potential use of uninitialized value. Always set @result to prevent uninitialized use. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
84960ca118
commit
f5eb6d0ad9
@ -706,6 +706,7 @@ virXMLPropInt(xmlNodePtr node,
|
|||||||
* @result: The returned value
|
* @result: The returned value
|
||||||
*
|
*
|
||||||
* Convenience function to return value of an unsigned integer attribute.
|
* Convenience function to return value of an unsigned integer attribute.
|
||||||
|
* @result is initialized to 0 on error or if the element is not found.
|
||||||
*
|
*
|
||||||
* Returns 1 in case of success in which case @result is set,
|
* Returns 1 in case of success in which case @result is set,
|
||||||
* or 0 if the attribute is not present,
|
* or 0 if the attribute is not present,
|
||||||
@ -722,6 +723,8 @@ virXMLPropUInt(xmlNodePtr node,
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
|
*result = 0;
|
||||||
|
|
||||||
if (!(tmp = virXMLPropString(node, name))) {
|
if (!(tmp = virXMLPropString(node, name))) {
|
||||||
if (!(flags & VIR_XML_PROP_REQUIRED))
|
if (!(flags & VIR_XML_PROP_REQUIRED))
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user