Android: Fix crash after changes in FreeRDP directory handling
This commit is contained in:
parent
3835fa8a35
commit
8d16086969
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user