mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
this is a fix for the file download problem. It does not correct the wrong chunk size, but it checks that the malloc returns something.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1442 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9834ef5cbf
commit
c9467a2bfe
@ -415,6 +415,11 @@ bool ftDataMultiplex::locked_handleServerRequest(ftFileProvider *provider,
|
||||
{
|
||||
void *data = malloc(chunksize);
|
||||
|
||||
if(data == NULL)
|
||||
{
|
||||
std::cerr << "WARNING: Could not allocate data for a chunksize of " << chunksize << std::endl ;
|
||||
return false ;
|
||||
}
|
||||
#ifdef MPLEX_DEBUG
|
||||
std::cerr << "ftDataMultiplex::locked_handleServerRequest()";
|
||||
std::cerr << "\t peer: " << peerId << " hash: " << hash;
|
||||
|
@ -100,7 +100,16 @@ bool ftFileProvider::getFileData(uint64_t offset, uint32_t &chunk_size, void *da
|
||||
}
|
||||
|
||||
if (data_size > 0)
|
||||
{
|
||||
{
|
||||
if(data == NULL)
|
||||
{
|
||||
std::cerr << "ftFileProvider: Warning ! Re-allocating data, which probably could not be allocated because of weird chunk size." << std::endl ;
|
||||
if(NULL == (data = malloc(data_size)))
|
||||
{
|
||||
std::cerr << "ftFileProvider: Could not malloc a size of " << data_size << std::endl ;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* seek for base_loc
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user