about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-25 15:20:05 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-25 15:20:05 +0100
commit490dcac380671314be0f2fc7f7ee4b1fb64e8f80 (patch)
treee2ec825d02e1092dc769107a68638f4031082379 /src
parente8264eb0dbbda0c7179652214b5ac308454c2586 (diff)
downloadbox64-490dcac380671314be0f2fc7f7ee4b1fb64e8f80.tar.gz
box64-490dcac380671314be0f2fc7f7ee4b1fb64e8f80.zip
Small change in getAlignedMutex function (probably more work needed)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/libtools/threads.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index 18f74951..dc6ce1cd 100755
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -678,8 +678,8 @@ pthread_mutex_t* getAlignedMutex(pthread_mutex_t* m)
 		return kh_value(unaligned_mutex, k);
 	int r;
 	k = kh_put(mutex, unaligned_mutex, (uintptr_t)m, &r);
-	pthread_mutex_t* ret = kh_value(unaligned_mutex, k) = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
-	memcpy(ret, m, sizeof(pthread_mutex_t));
+	pthread_mutex_t* ret = kh_value(unaligned_mutex, k) = (pthread_mutex_t*)calloc(1, sizeof(pthread_mutex_t));
+	memcpy(ret, m, sizeof(pthread_mutex_t));	// probably need some magic here on ARM64 to convert x86_64 mutex structure
 	return ret;
 }
 EXPORT int my_pthread_mutex_destroy(pthread_mutex_t *m)