mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
gh-140272: Fix memory leak in _gdbm.gdbm.clear() (GH-140274)
This commit is contained in:
parent
1bfe86caaa
commit
f937468e7c
2 changed files with 3 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix memory leak in the :meth:`!clear` method of the :mod:`dbm.gnu` database.
|
|
@ -673,8 +673,10 @@ _gdbm_gdbm_clear_impl(gdbmobject *self, PyTypeObject *cls)
|
||||||
}
|
}
|
||||||
if (gdbm_delete(self->di_dbm, key) < 0) {
|
if (gdbm_delete(self->di_dbm, key) < 0) {
|
||||||
PyErr_SetString(state->gdbm_error, "cannot delete item from database");
|
PyErr_SetString(state->gdbm_error, "cannot delete item from database");
|
||||||
|
free(key.dptr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
free(key.dptr);
|
||||||
}
|
}
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue