Android: Fix crash after changes in FreeRDP directory handling

This commit is contained in:
Martin Fleisz 2013-04-02 06:33:59 -07:00
parent 3835fa8a35
commit 8d16086969
2 changed files with 8 additions and 1 deletions

View File

@ -536,8 +536,12 @@ JNIEXPORT void JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cls, j
free(settings->HomePath);
free(settings->ConfigPath);
int config_dir_len = strlen(directory) + 10; /* +9 chars for /.freerdp and +1 for \0 */
char* config_dir_buf = (char*)malloc(config_dir_len);
strcpy(config_dir_buf, directory);
strcat(config_dir_buf, "/.freerdp");
settings->HomePath = strdup(directory);
settings->ConfigPath = NULL;
settings->ConfigPath = config_dir_buf; /* will be freed by freerdp library */
(*env)->ReleaseStringUTFChars(env, jdirectory, directory);
}

View File

@ -66,6 +66,9 @@ char* GetPath_HOME()
#ifdef _WIN32
path = GetEnvAlloc("UserProfile");
#elif defined(ANDROID)
path = malloc(2);
strcpy(path, "/");
#else
path = GetEnvAlloc("HOME");
#endif