mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-07 12:17:18 +00:00
Use explicit boolean comparison in OOM check
GCC 7 gets upset by if (!tmp && (size * count)) warning util/viralloc.c: In function 'virReallocN': util/viralloc.c:246:23: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] if (!tmp && (size * count)) { ~~~~~~^~~~~~~~ Keep it happy by adding != 0 to the right hand expression so it realizes we really are wanting to treat the result of the arithmetic expression as a boolean Signed-off-by: Daniel P. Berrange <berrange@redhat.com> (cherry picked from commit 09db97d3cbf334ea28969f08bac8a2fe4aafda16)
This commit is contained in:
parent
35a7d5084b
commit
68b19542ec
@ -243,7 +243,7 @@ int virReallocN(void *ptrptr,
|
||||
return -1;
|
||||
}
|
||||
tmp = realloc(*(void**)ptrptr, size * count);
|
||||
if (!tmp && (size * count)) {
|
||||
if (!tmp && ((size * count) != 0)) {
|
||||
if (report)
|
||||
virReportOOMErrorFull(domcode, filename, funcname, linenr);
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user