kent: avoid recursion

This commit is contained in:
anna 2022-10-10 14:32:29 +02:00
parent 3e35afcfa9
commit 5d2539fc4a
Signed by: fef
GPG key ID: EC22E476DC2D3D84

View file

@ -40,14 +40,13 @@ void kent_get(struct kent *kent)
void kent_put(struct kent *kent)
{
struct kent *parent = kent->parent;
if (atom_put(&kent->refcount) == 1) {
do {
struct kent *parent = kent->parent;
if (atom_put(&kent->refcount) != 1)
break;
kent->destroy(kent);
if (parent != NULL)
kent_put(parent);
}
kent = parent;
} while (kent != NULL);
}
/*