From 06ccd5bc122e955ab4ba0d77106a3b648388092b Mon Sep 17 00:00:00 2001 From: siavash119 Date: Thu, 31 Oct 2024 16:31:33 +0800 Subject: [PATCH] fix reply map value memory leak Signed-off-by: siavash119 --- src/reader.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/reader.c b/src/reader.c index 2ccab96..ba81cb5 100644 --- a/src/reader.c +++ b/src/reader.c @@ -87,13 +87,13 @@ static void *tryParentize(const valkeyReadTask *task, PyObject *obj) { Py_DECREF(obj); return NULL; } - if (PyDict_SetItem(parent, self->pendingObject, obj) < 0) { - Py_DECREF(obj); - Py_DECREF(self->pendingObject); - self->pendingObject = NULL; + int x = PyDict_SetItem(parent, self->pendingObject, obj); + Py_DECREF(obj); + Py_DECREF(self->pendingObject); + self->pendingObject = NULL; + if (x < 0) { return NULL; } - self->pendingObject = NULL; } break; case VALKEY_REPLY_SET: