client->credential = strdup(credential);
if (NULL == client->credential) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to allocate memory");
+ if (NULL != key) {
+ free(key);
+ key = NULL;
+ }
return TTS_ERROR_OUT_OF_MEMORY;
}
} else {
int pid = getpid();
char* appid = NULL;
int ret = app_manager_get_app_id(pid, &appid);
- if (0 != ret) {
+ if (0 != ret || NULL == appid) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get appid, ret(%d), pid(%d), appid(%s)", ret, pid, appid);
free(key);
key = NULL;
+ if (NULL != appid) {
+ free(appid);
+ appid = NULL;
+ }
return TTS_ERROR_OPERATION_FAILED;
}
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set private data, ret(%d), pid(%d), appid(%s)", ret, pid, appid);
free(key);
key = NULL;
+ free(appid);
+ appid = NULL;
return ret;
}