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:
csoler 2011-01-01 20:37:10 +00:00
parent e576c56e27
commit 8de9d39cc0
5 changed files with 37 additions and 24 deletions

View File

@ -304,6 +304,8 @@ void UdpLayer::recv_loop()
#endif #endif
} }
} }
free(inbuf) ;
return; return;
} }

View File

@ -765,10 +765,17 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
std::cerr << "AuthSSLimpl::AuthX509() X509 authenticated" << std::endl; std::cerr << "AuthSSLimpl::AuthX509() X509 authenticated" << std::endl;
#endif #endif
OPENSSL_free(buf_in) ;
OPENSSL_free(buf_hashout) ;
return true; return true;
err: err:
std::cerr << "AuthSSLimpl::AuthX509() X509 NOT authenticated" << std::endl; 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; return false;
} }

View File

@ -420,6 +420,8 @@ bool pqiSSLstore::encryptedSendItems(const std::list<RsItem*>& rsItemList)
return false; return false;
offset += sizeItem; offset += sizeItem;
if (!(bio_flags & BIN_FLAGS_NO_DELETE))
delete *it;
} }
if(sizeItems == offset) if(sizeItems == offset)

View File

@ -897,33 +897,33 @@ bool getAvailableAccounts(std::list<accountId> &ids)
std::cerr << "getAvailableAccounts()"; std::cerr << "getAvailableAccounts()";
std::cerr << std::endl; std::cerr << std::endl;
/* now iterate through the directory... /* now iterate through the directory...
* directories - flags as old, * directories - flags as old,
* files checked to see if they have changed. (rehashed) * files checked to see if they have changed. (rehashed)
*/ */
struct dirent *dent; struct dirent *dent;
struct stat buf; struct stat buf;
/* check for the dir existance */ /* check for the dir existance */
DIR *dir = opendir(RsInitConfig::basedir.c_str()); DIR *dir = opendir(RsInitConfig::basedir.c_str());
if (!dir) if (!dir)
{ {
std::cerr << "Cannot Open Base Dir - No Available Accounts" << std::endl; std::cerr << "Cannot Open Base Dir - No Available Accounts" << std::endl;
exit(1); exit(1);
} }
while(NULL != (dent = readdir(dir))) while(NULL != (dent = readdir(dir)))
{ {
/* check entry type */ /* check entry type */
std::string fname = dent -> d_name; std::string fname = dent -> d_name;
std::string fullname = RsInitConfig::basedir + "/" + fname; std::string fullname = RsInitConfig::basedir + "/" + fname;
if (-1 != stat(fullname.c_str(), &buf)) if (-1 != stat(fullname.c_str(), &buf))
{ {
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "buf.st_mode: " << buf.st_mode <<std::endl; std::cerr << "buf.st_mode: " << buf.st_mode <<std::endl;
#endif #endif
if (S_ISDIR(buf.st_mode)) if (S_ISDIR(buf.st_mode))
{ {
if ((fname == ".") || (fname == "..")) if ((fname == ".") || (fname == ".."))
@ -933,31 +933,32 @@ bool getAvailableAccounts(std::list<accountId> &ids)
#endif #endif
continue; /* skipping links */ continue; /* skipping links */
} }
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "Is Directory: " << fullname << std::endl; std::cerr << "Is Directory: " << fullname << std::endl;
#endif #endif
/* */ /* */
directories.push_back(fname); directories.push_back(fname);
} }
} }
} }
closedir(dir) ;
for(it = directories.begin(); it != directories.end(); it++) for(it = directories.begin(); it != directories.end(); it++)
{ {
std::string accountdir = RsInitConfig::basedir + RsInitConfig::dirSeperator + *it; std::string accountdir = RsInitConfig::basedir + RsInitConfig::dirSeperator + *it;
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl; std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
#endif #endif
accountId tmpId; accountId tmpId;
if (checkAccount(accountdir, tmpId)) if (checkAccount(accountdir, tmpId))
{ {
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl; std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
#endif #endif
ids.push_back(tmpId); ids.push_back(tmpId);
} }
} }

View File

@ -526,6 +526,7 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
std::cerr << "check_create_directory()"; std::cerr << "check_create_directory()";
std::cerr <<std::endl<< "\tDir Exists:" <<dir<<std::endl; std::cerr <<std::endl<< "\tDir Exists:" <<dir<<std::endl;
#endif #endif
closedir(direc) ;
return 1; return 1;
} }