From 5ff33a2a3716ea8daab534da697adc3bc1e83008 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Fri, 11 May 2018 13:30:11 -0700 Subject: [PATCH] PYTHON-1554 Fix datetime decoding memory leak --- bson/_cbsonmodule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c index 634748e72..b8048c593 100644 --- a/bson/_cbsonmodule.c +++ b/bson/_cbsonmodule.c @@ -2120,6 +2120,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer, /* convert to local time */ if (options->tzinfo != Py_None) { astimezone = PyObject_GetAttrString(value, "astimezone"); + Py_DECREF(value); if (!astimezone) { Py_DECREF(replace); Py_DECREF(args);