mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 17:05:50 +00:00
Fix misuse of sizeof on dynamic allocation
This commit is contained in:
parent
00de922f34
commit
638787d3dd
@ -3,6 +3,8 @@
|
|||||||
#include "PlatformThreads.h"
|
#include "PlatformThreads.h"
|
||||||
#include "LinkedBlockingQueue.h"
|
#include "LinkedBlockingQueue.h"
|
||||||
|
|
||||||
|
#define FIRST_FRAME_MAX 1500
|
||||||
|
|
||||||
PDECODER_RENDERER_CALLBACKS callbacks;
|
PDECODER_RENDERER_CALLBACKS callbacks;
|
||||||
PSTREAM_CONFIGURATION configuration;
|
PSTREAM_CONFIGURATION configuration;
|
||||||
IP_ADDRESS remoteHost;
|
IP_ADDRESS remoteHost;
|
||||||
@ -140,14 +142,14 @@ int readFirstFrame(void) {
|
|||||||
return LastSocketError();
|
return LastSocketError();
|
||||||
}
|
}
|
||||||
|
|
||||||
firstFrame = (char*)malloc(1500);
|
firstFrame = (char*) malloc(FIRST_FRAME_MAX);
|
||||||
if (firstFrame == NULL) {
|
if (firstFrame == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Limelog("Waiting for first frame\n");
|
Limelog("Waiting for first frame\n");
|
||||||
for (;;) {
|
for (;;) {
|
||||||
err = recv(firstFrameSocket, &firstFrame[offset], sizeof(firstFrame) - offset, 0);
|
err = recv(firstFrameSocket, &firstFrame[offset], FIRST_FRAME_MAX - offset, 0);
|
||||||
if (err <= 0) {
|
if (err <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user