Fixed memory leaks
Repository_read would not free the odb object after using it. Object_read_raw didn't close the odb object after usage
This commit is contained in:
7
pygit2.c
7
pygit2.c
@@ -324,11 +324,14 @@ Repository_read(Repository *self, PyObject *py_hex) {
|
||||
if (err < 0)
|
||||
return Error_set_py_obj(err, py_hex);
|
||||
|
||||
return Py_BuildValue(
|
||||
PyObject* tuple = Py_BuildValue(
|
||||
"(ns#)",
|
||||
git_odb_object_type(obj),
|
||||
git_odb_object_data(obj),
|
||||
git_odb_object_size(obj));
|
||||
|
||||
git_odb_object_close(obj);
|
||||
return tuple;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
@@ -797,6 +800,8 @@ Object_read_raw(Object *self) {
|
||||
git_odb_object_data(obj),
|
||||
git_odb_object_size(obj));
|
||||
|
||||
git_odb_object_close(obj);
|
||||
|
||||
cleanup:
|
||||
Py_XDECREF(py_sha);
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user