From afa4d64fca1672734ec474d6e8a1eeed4b34c6f4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 16 Feb 2023 15:11:02 +0000 Subject: [PATCH] python: Avoid leaking py_array and py_args in event callbacks See also: https://listman.redhat.com/archives/libguestfs/2023-February/030730.html https://listman.redhat.com/archives/libguestfs/2023-February/030745.html https://listman.redhat.com/archives/libguestfs/2023-February/030746.html Fixes: commit 6ef5837e2d8c5d4d83eff51c0201eb2e08f719de Thanks: Laszlo Ersek, Eric Blake Reviewed-by: Laszlo Ersek --- python/handle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/python/handle.c b/python/handle.c index 8eeabe60a..85089e6bc 100644 --- a/python/handle.c +++ b/python/handle.c @@ -134,6 +134,7 @@ guestfs_int_py_event_callback_wrapper (guestfs_h *g, args = Py_BuildValue ("(Kiy#O)", (unsigned PY_LONG_LONG) event, event_handle, buf, buf_len, py_array); + Py_DECREF (py_array); if (args == NULL) { PyErr_PrintEx (0); goto out;