mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-20 19:04:51 -04:00
!192 bug fix:bug fix: memory leak
Merge pull request !192 from 符子坤/master
This commit is contained in:
@@ -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 {
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user