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:
Sebastian Thiel
2011-07-08 11:54:36 +02:00
parent cf37c15059
commit a0975f78d5

View File

@@ -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;