mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
ocaml/guestfs-c.c: Avoid bogus -fanalyzer warning
This warning is bogus, caused by the analyzer cannot track that len ==
0 if roots == NULL. I just changed the code to make it easier to
analyze, this doesn't fix any real bug.
guestfs-c.c: In function 'guestfs_finalize':
guestfs-c.c:85:9: error: dereference of NULL '0B' [CWE-476] [-Werror=analyzer-null-dereference]
85 | caml_remove_generational_global_root (roots[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
@@ -79,7 +79,7 @@ guestfs_finalize (value gv)
|
||||
guestfs_close (g);
|
||||
|
||||
/* Now unregister the global roots. */
|
||||
if (len > 0) {
|
||||
if (roots && len > 0) {
|
||||
size_t i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
caml_remove_generational_global_root (roots[i]);
|
||||
|
||||
Reference in New Issue
Block a user