Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
fix: memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Antares0982 committed May 11, 2024
1 parent fdab3da commit d3868d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pycJSON_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ PyObject *pycJSON_Decode(PyObject *self, PyObject *args, PyObject *kwargs) {
parse_buffer buffer = {0, 0, 0, 0, {0, 0}, 0};
PyObject *item = NULL;

const char *value;
const char *value = NULL;
Py_ssize_t buffer_length;
static const char *kwlist[] = {"s", "object_hook", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O", (char **) kwlist, &value, &buffer_length, &buffer.object_hook)) {
Expand Down Expand Up @@ -721,6 +721,7 @@ PyObject *pycJSON_Decode(PyObject *self, PyObject *args, PyObject *kwargs) {
return item;

fail:
Py_XDECREF(item);
if (value != NULL && !PyErr_Occurred()) {
Py_ssize_t position = 0;

Expand Down

0 comments on commit d3868d9

Please sign in to comment.