mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
snapshot: clear htable on cleanup
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
@@ -120,6 +120,12 @@ static int snapshot_add_entry(snapshot_t * snapshot, const char *filename,
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int talloc_clear_htable(snapshot_t *s)
|
||||
{
|
||||
htable_clear(&s->ht);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snapshot_init(void *pool, struct snapshot_t **snapshot, const char *prefix)
|
||||
{
|
||||
snapshot_t *new_snapshot = NULL;
|
||||
@@ -141,6 +147,7 @@ int snapshot_init(void *pool, struct snapshot_t **snapshot, const char *prefix)
|
||||
goto cleanup;
|
||||
|
||||
htable_init(&new_snapshot->ht, snapshot_rehash, new_snapshot);
|
||||
talloc_set_destructor(new_snapshot, talloc_clear_htable);
|
||||
|
||||
*snapshot = new_snapshot;
|
||||
new_snapshot = NULL;
|
||||
|
||||
Reference in New Issue
Block a user