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) void kent_put(struct kent *kent)
{ {
do {
struct kent *parent = kent->parent; struct kent *parent = kent->parent;
if (atom_put(&kent->refcount) != 1)
if (atom_put(&kent->refcount) == 1) { break;
kent->destroy(kent); kent->destroy(kent);
kent = parent;
if (parent != NULL) } while (kent != NULL);
kent_put(parent);
}
} }
/* /*