diff --git a/common/database/src/idm_database.c b/common/database/src/idm_database.c index 5dd296dab6f5f3083d857887da8a961aee65a1da..2cdab3c971b0734efa73c7dd5f917c9365e89ac7 100644 --- a/common/database/src/idm_database.c +++ b/common/database/src/idm_database.c @@ -702,6 +702,7 @@ ResultCode QueryCredentialFromExecutor(uint32_t authType, CredentialInfoHal **cr LOG_ERROR("no memory"); return RESULT_NO_MEMORY; } + *num = 0; LinkedListNode *temp = g_userInfoList->head; while (temp != NULL) { UserInfo *user = (UserInfo *)temp->data; @@ -709,7 +710,7 @@ ResultCode QueryCredentialFromExecutor(uint32_t authType, CredentialInfoHal **cr if (credentialQuery != NULL) { (*num)++; if (*num <= preApplyNum) { - *credentialInfos[*num - 1] = *credentialQuery; + (*credentialInfos)[*num - 1] = *credentialQuery; temp = temp->next; continue; } @@ -731,9 +732,9 @@ ResultCode QueryCredentialFromExecutor(uint32_t authType, CredentialInfoHal **cr } Free(*credentialInfos); *credentialInfos = credentialsTemp; - *credentialInfos[*num - 1] = *credentialQuery; + (*credentialInfos)[*num - 1] = *credentialQuery; } temp = temp->next; } return RESULT_SUCCESS; -} \ No newline at end of file +}