Merge pull request #6299 from ton31337/fix/access-list_deletion

lib: Delete the entire access-list only if there are no more entries
This commit is contained in:
Donald Sharp 2020-04-29 08:31:31 -04:00 committed by GitHub
commit cd8e0b88e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,12 +437,12 @@ static struct filter *filter_seq_check(struct access_list *access,
}
/* If access_list has no filter then return 1. */
static int access_list_empty(struct access_list *access)
static bool access_list_empty(struct access_list *access)
{
if (access->head == NULL && access->tail == NULL)
return 1;
return true;
else
return 0;
return false;
}
/* Delete filter from specified access_list. If there is hook
@ -451,6 +451,7 @@ static void access_list_filter_delete(struct access_list *access,
struct filter *filter)
{
struct access_master *master;
struct filter *replace = filter;
master = access->master;
@ -472,7 +473,7 @@ static void access_list_filter_delete(struct access_list *access,
(*master->delete_hook)(access);
/* If access_list becomes empty delete it from access_master. */
if (access_list_empty(access))
if (access_list_empty(access) && !replace)
access_list_delete(access);
}