Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
Free aclcache object when removed from hash table
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreF committed Jul 24, 2015
1 parent 57ed2ed commit e66f464
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void acl_cache(const char *clientid, const char *username, const char *topic, in
if (time(NULL) > (a->seconds + cacheseconds)) {
_log(DEBUG, " Expired [%s] for (%s,%s,%d)", hex, clientid, username, access);
HASH_DEL(ud->aclcache, a);
free(a);
}
} else {
a = (struct aclcache *)malloc(sizeof(struct aclcache));
Expand All @@ -130,6 +131,7 @@ void acl_cache(const char *clientid, const char *username, const char *topic, in
if (now > (a->seconds + ud->cacheseconds)) {
_log(DEBUG, " Cleanup [%s]", a->hex);
HASH_DEL(ud->aclcache, a);
free(a);
}
}
}
Expand Down Expand Up @@ -159,6 +161,7 @@ int cache_q(const char *clientid, const char *username, const char *topic, int a
if (time(NULL) > (a->seconds + cacheseconds)) {
_log(DEBUG, " Expired [%s] for (%s,%s,%d)", hex, clientid, username, access);
HASH_DEL(ud->aclcache, a);
free(a);
} else {
granted = a->granted;
}
Expand Down

0 comments on commit e66f464

Please sign in to comment.