goto FINISH_OFF;
}
strncpy(*buf, pTemp, sLen);
+ (*buf)[sLen] = '\0';
} else
*buf = NULL;
}
if (value != NULL)
ret = sqlite3_bind_text(hStmt, index+1, value, -1, SQLITE_STATIC);
else
- ret = sqlite3_bind_text(hStmt, index+1, "", -1, NULL);
+ ret = sqlite3_bind_text(hStmt, index+1, "", -1, SQLITE_STATIC);
if (ret != SQLITE_OK) {
EM_DEBUG_EXCEPTION("sqlite3_bind_text fail [%d]", ret);
return true;
}
-/* destroy function for sqlite3_bind_text */
-void _bind_stmt_free_string(void* arg)
-{
- EM_DEBUG_FUNC_BEGIN();
- char* p = (char*) arg;
- EM_SAFE_FREE(p);
- EM_DEBUG_FUNC_END();
-}
-
static int _bind_stmt_field_data_nstring(DB_STMT hStmt, int index, char *value, int ucs2, int max_len)
{
if ((hStmt == NULL) || (index < 0)) {
return false;
}
snprintf(buf, max_len-1, "%s", value);
- ret = sqlite3_bind_text(hStmt, index+1, buf, -1, _bind_stmt_free_string);
+ ret = sqlite3_bind_text(hStmt, index+1, buf, -1, SQLITE_TRANSIENT);
+ g_free(buf);
}
} else
- ret = sqlite3_bind_text(hStmt, index+1, "", -1, NULL);
+ ret = sqlite3_bind_text(hStmt, index+1, "", -1, SQLITE_STATIC);
if (ret != SQLITE_OK) {
EM_DEBUG_EXCEPTION("sqlite3_bind_text fail [%d]", ret);
thread_func_event_data->multi_user_name = g_strdup(multi_user_name);
THREAD_CREATE(delete_thread, thread_func_to_delete_mail, (void *)thread_func_event_data, thread_error);
- THREAD_DETACH(delete_thread); /* free resources used for new thread */
+ if (thread_error == 0)
+ THREAD_DETACH(delete_thread); /* free resources used for new thread */
ret = true;
FINISH_OFF2:
thread_func_event_data->multi_user_name = g_strdup(multi_user_name);
THREAD_CREATE(move_thread, thread_func_to_move_mail, (void*)thread_func_event_data, thread_error);
- THREAD_DETACH(move_thread); /* free resources used for new thread */
+ if (thread_error == 0)
+ THREAD_DETACH(move_thread); /* free resources used for new thread */
EM_DEBUG_LOG("thread_error [%d]", thread_error);
ret = true;
thread_func_event_data->multi_user_name = g_strdup(multi_user_name);
THREAD_CREATE(move_thread, thread_func_to_move_mail, (void*)thread_func_event_data, thread_error);
- THREAD_DETACH(move_thread); /* free resources used for new thread */
+ if (thread_error == 0)
+ THREAD_DETACH(move_thread); /* free resources used for new thread */
EM_DEBUG_LOG("thread_error [%d]", thread_error);
ret = true;