Commit ea4452de3c71ab3028c4f24f882806dc321b92ec
1 parent
485a4cff
try to fix strange stack overflow issue
Showing
1 changed file
with
6 additions
and
3 deletions
| ... | ... | @@ -51,11 +51,12 @@ static |
| 51 | 51 | TR_RemoteData |
| 52 | 52 | udpSocketRecv(TR_Socket this, size_t size) |
| 53 | 53 | { |
| 54 | - unsigned char buffer[size]; | |
| 54 | + unsigned char * buffer = TR_malloc(size); | |
| 55 | 55 | ssize_t received; |
| 56 | 56 | TR_RemoteData rdata; |
| 57 | - TR_Socket remote = TR_new(TR_UdpSocket, TR_socketLog(this), NULL, 0, 0); | |
| 58 | - | |
| 57 | + TR_Socket remote; | |
| 58 | + | |
| 59 | + remote = TR_new(TR_UdpSocket, this->log, NULL, 0, 0); | |
| 59 | 60 | remote->addrlen = this->addrlen; |
| 60 | 61 | |
| 61 | 62 | received = recvfrom( |
| ... | ... | @@ -72,6 +73,8 @@ udpSocketRecv(TR_Socket this, size_t size) |
| 72 | 73 | rdata = TR_new(TR_RemoteData, buffer, received, remote); |
| 73 | 74 | } |
| 74 | 75 | |
| 76 | + TR_MEM_FREE(buffer); | |
| 77 | + | |
| 75 | 78 | rdata->free_remote = 1; |
| 76 | 79 | |
| 77 | 80 | return rdata; | ... | ... |
Please
register
or
login
to post a comment