Skip to content

Commit ddc4301

Browse files
t-wyK0lb3
authored andcommitted
Attempt to fix ref count memory leak caused by ASTCContext.decompress
1 parent a0d704a commit ddc4301

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/pybind.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ PyObject *ASTCContext_method_decompress(ASTContextT *self, PyObject *args, PyObj
673673
}
674674

675675
// create a python bytes object from the decompressed data
676-
Py_IncRef(py_image_data);
676+
// Py_IncRef(py_image_data); // ref count is already increased by PyBytes_FromStringAndSize
677677
Py_DecRef(py_image->data);
678678
py_image->data = py_image_data;
679679

@@ -847,4 +847,4 @@ PyMODINIT_FUNC INIT_FUNC_NAME(void)
847847
}
848848

849849
return m;
850-
}
850+
}

0 commit comments

Comments
 (0)