Merge branch 'master-merge-helper'

* master-merge-helper:
  possible use after free forbidden
  Suppression of unused code
  Fix of some memory leaks
  removing dead code
  A destructor must free the memory allocated by the constructor
  Good overridance with the good qualifier
  Better use of operators priorities
  protection from bad frees on unallocated strings
This commit is contained in:
Robin Sommer 2012-02-24 16:34:17 -08:00
commit ada5f38d04
22 changed files with 67 additions and 30 deletions

View file

@ -85,12 +85,13 @@ void BroDoc::AddImport(const std::string& s)
if ( ext_pos != std::string::npos )
lname = lname.substr(0, ext_pos);
const char* full_filename = "<error>";
const char* subpath = "<error>";
const char* full_filename = NULL;
const char* subpath = NULL;
FILE* f = search_for_file(lname.c_str(), "bro", &full_filename, true,
&subpath);
if ( f )
if ( f && full_filename && subpath )
{
fclose(f);
@ -126,12 +127,14 @@ void BroDoc::AddImport(const std::string& s)
}
delete [] tmp;
delete [] full_filename;
delete [] subpath;
}
else
fprintf(stderr, "Failed to document '@load %s' in file: %s\n",
s.c_str(), reST_filename.c_str());
delete [] full_filename;
delete [] subpath;
}
void BroDoc::SetPacketFilter(const std::string& s)