mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
[3.13] gh-140272: Fix memory leak in _gdbm.gdbm.clear() (GH-140274) (GH-140289)
(cherry picked from commit f937468e7c
)
Co-authored-by: Shamil <ashm.tech@proton.me>
This commit is contained in:
parent
0760a572f7
commit
0231a391f9
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.
|
|
@ -612,8 +612,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