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;
}
/* add a rule for daemon error */
char rule_err[256] = {0, };
tts_client_s* client = tts_client_get_by_uid(uid);
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "Fail to get TTS client");
+ return TTS_ERROR_OPERATION_FAILED;
+ }
+
if (TTS_MODE_DEFAULT == client->mode) {
snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", TTS_SERVER_SERVICE_INTERFACE);
} else if (TTS_MODE_NOTIFICATION == client->mode) {
/* remove a rule for daemon error */
char rule_err[256] = {0, };
tts_client_s* client = tts_client_get_by_uid(uid);
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "Fail to get TTS client");
+ return TTS_ERROR_OPERATION_FAILED;
+ }
+
if (TTS_MODE_DEFAULT == client->mode) {
snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", TTS_SERVER_SERVICE_INTERFACE);
} else if (TTS_MODE_NOTIFICATION == client->mode) {