Bläddra i källkod

event: Fix memory leak getting future result in some cases

rdb 4 år sedan
förälder
incheckning
e348d216e5
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      panda/src/event/asyncFuture_ext.cxx

+ 1 - 1
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());
           ((void *)value, Dtool_ParamValueBase, false, false, type.get_index());
         if (wrap != nullptr) {
         if (wrap != nullptr) {
           PyObject *value = PyObject_GetAttrString(wrap, "value");
           PyObject *value = PyObject_GetAttrString(wrap, "value");
+          Py_DECREF(wrap);
           if (value != nullptr) {
           if (value != nullptr) {
             return value;
             return value;
           }
           }
           PyErr_Restore(nullptr, nullptr, nullptr);
           PyErr_Restore(nullptr, nullptr, nullptr);
-          Py_DECREF(wrap);
         }
         }
       }
       }