From e348d216e5ffcdf545326bfc5ca08995025b9f1f Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 1 Mar 2021 11:09:10 +0100 Subject: [PATCH] event: Fix memory leak getting future result in some cases --- panda/src/event/asyncFuture_ext.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/event/asyncFuture_ext.cxx b/panda/src/event/asyncFuture_ext.cxx index 9754142ae3..b11f0232ca 100644 --- a/panda/src/event/asyncFuture_ext.cxx +++ b/panda/src/event/asyncFuture_ext.cxx @@ -99,11 +99,11 @@ static PyObject *get_done_result(const AsyncFuture *future) { ((void *)value, Dtool_ParamValueBase, false, false, type.get_index()); if (wrap != nullptr) { PyObject *value = PyObject_GetAttrString(wrap, "value"); + Py_DECREF(wrap); if (value != nullptr) { return value; } PyErr_Restore(nullptr, nullptr, nullptr); - Py_DECREF(wrap); } }