From ceb034c92cbb140bcba4bad5b6503c0995795186 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Sep 2021 16:48:26 +0100 Subject: [PATCH] python, java: Avoid bogus -fanalyzer warnings This is essentially the same as the previous OCaml commit. It does not fix a real bug. --- java/handle.c | 2 +- python/handle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/handle.c b/java/handle.c index fb6870728..c381610d3 100644 --- a/java/handle.c +++ b/java/handle.c @@ -96,7 +96,7 @@ Java_com_redhat_et_libguestfs_GuestFS__1close guestfs_close (g); - if (len > 0) { + if (data && len > 0) { size_t i; for (i = 0; i < len; ++i) { (*env)->DeleteGlobalRef (env, data[i]->callback); diff --git a/python/handle.c b/python/handle.c index 9edf98864..3a62d3050 100644 --- a/python/handle.c +++ b/python/handle.c @@ -88,7 +88,7 @@ guestfs_int_py_close (PyObject *self, PyObject *args) guestfs_close (g); Py_END_ALLOW_THREADS; - if (len > 0) { + if (callbacks && len > 0) { size_t i; for (i = 0; i < len; ++i) Py_XDECREF (callbacks[i]);