summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorYun-Hao Chung <howardchung@chromium.org>2021-08-31 13:39:00 +0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-08-31 17:56:10 -0700
commit355d06b3f32147c1dfa39bfd1cd2d4e346b65492 (patch)
treec52744a32a73b9d9529958fa4abf0b8027c82306 /plugins
parentfc77feb09195bd22d34e7cd8278d0123b6b3c061 (diff)
downloadbluez-355d06b3f32147c1dfa39bfd1cd2d4e346b65492.tar.gz
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 <mcchou@chromium.org>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/admin.c7
1 files changed, 6 insertions, 1 deletions
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;