From e1a34bc47c046ffe05505a3bda98e466750e9fa1 Mon Sep 17 00:00:00 2001 From: YuanRisheng Date: Wed, 8 Jun 2022 10:41:15 +0800 Subject: [PATCH] fix bugs (#43294) --- paddle/fluid/pybind/eager_utils.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paddle/fluid/pybind/eager_utils.cc b/paddle/fluid/pybind/eager_utils.cc index 9bcac35037..cdbdb8c642 100644 --- a/paddle/fluid/pybind/eager_utils.cc +++ b/paddle/fluid/pybind/eager_utils.cc @@ -734,12 +734,15 @@ PyObject* ToPyObject( PADDLE_THROW( platform::errors::Fatal("Unable to append string to py_list")); } + Py_DECREF(val_string); } if (PyDict_SetItem(dict, key_string, py_list) != 0) { PADDLE_THROW( platform::errors::Fatal("Unable to set key:value for py_dict")); } + Py_DECREF(py_list); + Py_DECREF(key_string); } return dict; -- GitLab