From 355d06b3f32147c1dfa39bfd1cd2d4e346b65492 Mon Sep 17 00:00:00 2001 From: Yun-Hao Chung Date: Tue, 31 Aug 2021 13:39:00 +0800 Subject: plugin/admin: fix set empty allowlist no persistence issue This patch fixes a bug when setting empty service allowlist, the allowlist sets successfully but it fails to be stored in the file. Reviewed-by: Miao-chen Chou --- plugins/admin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/admin.c b/plugins/admin.c index aea33cb71..02fec0456 100644 --- a/plugins/admin.c +++ b/plugins/admin.c @@ -196,12 +196,17 @@ static char **new_uuid_strings(struct queue *allowlist, gsize *num) char **uuid_strs = NULL; gsize i = 0, allowlist_num; + allowlist_num = queue_length(allowlist); + if (!allowlist_num) { + *num = 0; + return NULL; + } + /* Set num to a non-zero number so that whoever call this could know if * this function success or not */ *num = 1; - allowlist_num = queue_length(allowlist); uuid_strs = g_try_malloc_n(allowlist_num, sizeof(char *)); if (!uuid_strs) return NULL; -- cgit v1.2.1