summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-cred.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/afb-cred.c b/src/afb-cred.c
index b7b3175e..a2cb577a 100644
--- a/src/afb-cred.c
+++ b/src/afb-cred.c
@@ -169,10 +169,12 @@ struct afb_cred *afb_cred_addref(struct afb_cred *cred)
void afb_cred_unref(struct afb_cred *cred)
{
if (cred && !__atomic_sub_fetch(&cred->refcount, 1, __ATOMIC_RELAXED)) {
- if (cred != current)
- free(cred);
- else
+ if (cred == current)
cred->refcount = 1;
+ else {
+ free((void*)cred->exported);
+ free(cred);
+ }
}
}