Browse Source

GitHub issue #1000

Adam Ierymenko 6 năm trước cách đây
mục cha
commit
1c7b553331
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      osdep/LinuxNetLink.cpp

+ 5 - 1
osdep/LinuxNetLink.cpp

@@ -103,7 +103,11 @@ void LinuxNetLink::_setSocketTimeout(int fd, int seconds)
 #define ZT_NL_BUF_SIZE 16384
 #define ZT_NL_BUF_SIZE 16384
 int LinuxNetLink::_doRecv(int fd)
 int LinuxNetLink::_doRecv(int fd)
 {
 {
-	char *const buf = (char *)valloc(ZT_NL_BUF_SIZE);
+	char *buf = nullptr;
+	if (posix_memalign((void **)&buf,16,ZT_NL_BUF_SIZE) != 0) {
+		fprintf(stderr,"malloc failed!\n");
+		::exit(1);
+	}
 	if (!buf) {
 	if (!buf) {
 		fprintf(stderr,"malloc failed!\n");
 		fprintf(stderr,"malloc failed!\n");
 		::exit(1);
 		::exit(1);