From 76784e4ecea4317f99cb7f684bb4202ef09df69d Mon Sep 17 00:00:00 2001 From: weiguo Date: Sat, 29 Jan 2022 20:43:16 +0800 Subject: [PATCH] Use object size then pointer size when malloc (#10201) (#10202) By a happy coincidence, sizeof(sds *) is equal to sizeof(sds) here, while it's logically consistent to use sizeof(sds) instead. --- src/acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acl.c b/src/acl.c index 174861f4a..d6e156d5f 100644 --- a/src/acl.c +++ b/src/acl.c @@ -2533,7 +2533,7 @@ void aclCommand(client *c) { } int merged_argc = 0, invalid_idx = 0; - sds *temp_argv = zmalloc(c->argc * sizeof(sds *)); + sds *temp_argv = zmalloc(c->argc * sizeof(sds)); for (int i = 3; i < c->argc; i++) temp_argv[i-3] = c->argv[i]->ptr; sds *acl_args = ACLMergeSelectorArguments(temp_argv, c->argc - 3, &merged_argc, &invalid_idx); zfree(temp_argv);