mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 07:16:11 -05:00
Suppressed 4 memory leaks:
- authssl would call OPENSSL_malloc without OPENSSL_free - pqistore was not deleting items in pqiSSLStore when BIN_FLAGS_NO_DELETE is not here - rsdir/rsinit were calling opendir withoug closedir (which might eat FDs, in addition) - udplayer was not freeing it's 16KB buffer at end of loop. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3948 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e576c56e27
commit
8de9d39cc0
@ -304,6 +304,8 @@ void UdpLayer::recv_loop()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
free(inbuf) ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -765,10 +765,17 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
|
||||
std::cerr << "AuthSSLimpl::AuthX509() X509 authenticated" << std::endl;
|
||||
#endif
|
||||
|
||||
OPENSSL_free(buf_in) ;
|
||||
OPENSSL_free(buf_hashout) ;
|
||||
return true;
|
||||
|
||||
err:
|
||||
std::cerr << "AuthSSLimpl::AuthX509() X509 NOT authenticated" << std::endl;
|
||||
|
||||
if(buf_in != NULL)
|
||||
OPENSSL_free(buf_in) ;
|
||||
if(buf_hashout != NULL)
|
||||
OPENSSL_free(buf_hashout) ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -420,6 +420,8 @@ bool pqiSSLstore::encryptedSendItems(const std::list<RsItem*>& rsItemList)
|
||||
return false;
|
||||
offset += sizeItem;
|
||||
|
||||
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
|
||||
delete *it;
|
||||
}
|
||||
|
||||
if(sizeItems == offset)
|
||||
|
@ -897,33 +897,33 @@ bool getAvailableAccounts(std::list<accountId> &ids)
|
||||
std::cerr << "getAvailableAccounts()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* now iterate through the directory...
|
||||
* directories - flags as old,
|
||||
* files checked to see if they have changed. (rehashed)
|
||||
*/
|
||||
/* now iterate through the directory...
|
||||
* directories - flags as old,
|
||||
* files checked to see if they have changed. (rehashed)
|
||||
*/
|
||||
|
||||
struct dirent *dent;
|
||||
struct stat buf;
|
||||
|
||||
/* check for the dir existance */
|
||||
DIR *dir = opendir(RsInitConfig::basedir.c_str());
|
||||
struct dirent *dent;
|
||||
struct stat buf;
|
||||
|
||||
/* check for the dir existance */
|
||||
DIR *dir = opendir(RsInitConfig::basedir.c_str());
|
||||
if (!dir)
|
||||
{
|
||||
std::cerr << "Cannot Open Base Dir - No Available Accounts" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while(NULL != (dent = readdir(dir)))
|
||||
{
|
||||
while(NULL != (dent = readdir(dir)))
|
||||
{
|
||||
/* check entry type */
|
||||
std::string fname = dent -> d_name;
|
||||
std::string fullname = RsInitConfig::basedir + "/" + fname;
|
||||
|
||||
|
||||
if (-1 != stat(fullname.c_str(), &buf))
|
||||
{
|
||||
#ifdef FIM_DEBUG
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "buf.st_mode: " << buf.st_mode <<std::endl;
|
||||
#endif
|
||||
#endif
|
||||
if (S_ISDIR(buf.st_mode))
|
||||
{
|
||||
if ((fname == ".") || (fname == ".."))
|
||||
@ -933,31 +933,32 @@ bool getAvailableAccounts(std::list<accountId> &ids)
|
||||
#endif
|
||||
continue; /* skipping links */
|
||||
}
|
||||
|
||||
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "Is Directory: " << fullname << std::endl;
|
||||
std::cerr << "Is Directory: " << fullname << std::endl;
|
||||
#endif
|
||||
|
||||
/* */
|
||||
directories.push_back(fname);
|
||||
/* */
|
||||
directories.push_back(fname);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir) ;
|
||||
|
||||
for(it = directories.begin(); it != directories.end(); it++)
|
||||
{
|
||||
std::string accountdir = RsInitConfig::basedir + RsInitConfig::dirSeperator + *it;
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
|
||||
#endif
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
|
||||
#endif
|
||||
|
||||
accountId tmpId;
|
||||
if (checkAccount(accountdir, tmpId))
|
||||
{
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
|
||||
#endif
|
||||
#ifdef GPG_DEBUG
|
||||
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
|
||||
#endif
|
||||
ids.push_back(tmpId);
|
||||
}
|
||||
}
|
||||
|
@ -526,6 +526,7 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
|
||||
std::cerr << "check_create_directory()";
|
||||
std::cerr <<std::endl<< "\tDir Exists:" <<dir<<std::endl;
|
||||
#endif
|
||||
closedir(direc) ;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user