Skip to content

Commit 898c3c8

Browse files
authored
Merge pull request #25 from siavash119/patch-1
Fix reply map value memory leak
2 parents a85254f + 06ccd5b commit 898c3c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/reader.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ static void *tryParentize(const valkeyReadTask *task, PyObject *obj) {
8787
Py_DECREF(obj);
8888
return NULL;
8989
}
90-
if (PyDict_SetItem(parent, self->pendingObject, obj) < 0) {
91-
Py_DECREF(obj);
92-
Py_DECREF(self->pendingObject);
93-
self->pendingObject = NULL;
90+
int x = PyDict_SetItem(parent, self->pendingObject, obj);
91+
Py_DECREF(obj);
92+
Py_DECREF(self->pendingObject);
93+
self->pendingObject = NULL;
94+
if (x < 0) {
9495
return NULL;
9596
}
96-
self->pendingObject = NULL;
9797
}
9898
break;
9999
case VALKEY_REPLY_SET:

0 commit comments

Comments
 (0)