Merge pull request #423 from devnexen/curl_build_fix

curl buffer resizing lost fix proposal.
This commit is contained in:
Yamagi 2019-07-20 15:34:00 +02:00 committed by GitHub
commit 56b3d91786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,13 @@ static size_t CL_HTTP_Recv(void *ptr, size_t size, size_t nmemb, void *stream)
else if (dl->position + bytes >= dl->fileSize)
{
dl->fileSize *= 2;
realloc(dl->tempBuffer, dl->fileSize);
char *tempBuffer = realloc(dl->tempBuffer, dl->fileSize);
if (!tempBuffer) {
free(dl->tempBuffer);
dl->tempBuffer = 0;
return 0;
}
dl->tempBuffer = tempBuffer;
}
memcpy (dl->tempBuffer + dl->position, ptr, bytes);