mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 07:35:12 -04:00
Memory leaks:
- ftController::copyFile -> buffer and file pointer leaks in case of error - PeersDialog::insertSendList -> new QTreeWidgetItem for all online peers, this function is not ready yet - PeersDialog::insertPeers -> gpg_item = new QTreeWidgetItem(0); in case of no more accept connection - pqissl::reset -> missing SSL_free of ssl_connection Missing return: - IntroPage::nextId git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2891 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
faace1f322
commit
b242b73f31
4 changed files with 32 additions and 15 deletions
|
@ -629,8 +629,6 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
{
|
||||
std::string error ;
|
||||
|
||||
static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up.
|
||||
void *buffer = malloc(BUFF_SIZE) ;
|
||||
FILE *in = fopen(source.c_str(),"rb") ;
|
||||
|
||||
if(in == NULL)
|
||||
|
@ -644,12 +642,18 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
if(out == NULL)
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCheck for disk full, or write permission ?\nOriginal file kept under the name "+source);
|
||||
fclose (in);
|
||||
return false ;
|
||||
}
|
||||
|
||||
size_t s=0;
|
||||
size_t T=0;
|
||||
|
||||
static const int BUFF_SIZE = 10485760 ; // 10 MB buffer to speed things up.
|
||||
void *buffer = malloc(BUFF_SIZE) ;
|
||||
|
||||
bool bRet = true;
|
||||
|
||||
while( (s = fread(buffer,1,BUFF_SIZE,in)) > 0)
|
||||
{
|
||||
size_t t = fwrite(buffer,1,s,out) ;
|
||||
|
@ -658,7 +662,8 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
if(t != s)
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nIs your disc full ?\nOriginal file kept under the name "+source);
|
||||
return false ;
|
||||
bRet = false ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ int pqissl::reset()
|
|||
active = false;
|
||||
sockfd = -1;
|
||||
waiting = WAITING_NOT;
|
||||
SSL_free (ssl_connection);
|
||||
ssl_connection = NULL;
|
||||
sameLAN = false;
|
||||
n_read_zero = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue