!192 bug fix:bug fix: memory leak

Merge pull request !192 from 符子坤/master
This commit is contained in:
openharmony_ci
2022-03-23 11:39:14 +00:00
committed by Gitee
3 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -241,11 +241,12 @@ int32_t ToUpperCase(const char *oriStr, char **desStr)
if (oriStr == NULL || desStr == NULL) {
return CLIB_ERR_NULL_PTR;
}
*desStr = ClibMalloc(strlen(oriStr) + 1, 0);
uint32_t len = strlen(oriStr);
*desStr = ClibMalloc(len + 1, 0);
if (*desStr == NULL) {
return CLIB_ERR_BAD_ALLOC;
}
for (uint32_t i = 0; i < strlen(oriStr); i++) {
for (uint32_t i = 0; i < len; i++) {
if ((oriStr[i] >= 'a') && (oriStr[i] <= 'f')) {
(*desStr)[i] = oriStr[i] - ASCII_CASE_DIFFERENCE_VALUE;
} else {
@@ -61,7 +61,7 @@ static int ExchangeRequest(AsyBaseCurTask *task, PakeParams *params, const CJson
res = ClientRequestStandardUnbindExchange(params, &(realTask->params));
if (res != HC_SUCCESS) {
LOGE("ClientRequestStandardUnbindExchange failed");
return res;
goto ERR;
}
// package message
@@ -286,6 +286,7 @@ static int32_t AddAuthIdAndUserTypeToParams(int32_t osAccountId, const char *gro
int32_t res = HcGetUdid((uint8_t *)localUdid, INPUT_UDID_LEN);
if (res != HC_SUCCESS) {
LOGE("Failed to get local udid! res: %d", res);
DestroyDeviceEntry(deviceInfo);
return HC_ERR_DB;
}