Commit 0dd0ed3f by Peter Stokes Committed by Victor M. Alvarez

Fix issue #242 (#243)

Address incorrect reference counting.
parent 836fd9ea
...@@ -1884,6 +1884,7 @@ static void StringMatchInstance_dealloc( ...@@ -1884,6 +1884,7 @@ static void StringMatchInstance_dealloc(
Py_DECREF(object->offset); Py_DECREF(object->offset);
Py_DECREF(object->matched_data); Py_DECREF(object->matched_data);
Py_DECREF(object->matched_length);
Py_DECREF(object->xor_key); Py_DECREF(object->xor_key);
PyObject_Del(self); PyObject_Del(self);
...@@ -1923,7 +1924,10 @@ static PyObject* StringMatchInstance_plaintext( ...@@ -1923,7 +1924,10 @@ static PyObject* StringMatchInstance_plaintext(
StringMatchInstance* instance = (StringMatchInstance*) self; StringMatchInstance* instance = (StringMatchInstance*) self;
uint64_t xor_key = PyLong_AsUnsignedLongLong(instance->xor_key); uint64_t xor_key = PyLong_AsUnsignedLongLong(instance->xor_key);
if (xor_key == 0) if (xor_key == 0)
{
Py_INCREF(instance->matched_data);
return instance->matched_data; return instance->matched_data;
}
int result = PyBytes_AsStringAndSize(instance->matched_data, &pb, &length); int result = PyBytes_AsStringAndSize(instance->matched_data, &pb, &length);
if (result == -1) if (result == -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment