we don't need to strdup the device name

This commit is contained in:
Arnout Engelen
2012-03-15 23:30:38 +00:00
parent ac7bb5c315
commit 227f8bddd2
2 changed files with 4 additions and 5 deletions

View File

@@ -58,7 +58,7 @@ extern std::map <std::string, unsigned long> conninode;
* * unknown TCP traffic * * unknown TCP traffic
* * UDP traffic * * UDP traffic
* * unknown IP traffic * * unknown IP traffic
* We must take care this one never gets removed from the list. * We must take care these never get removed from the list.
*/ */
Process * unknowntcp; Process * unknowntcp;
Process * unknownudp; Process * unknownudp;

View File

@@ -65,7 +65,7 @@ private:
class Process class Process
{ {
public: public:
/* the process makes a copy of the device name and name. */ /* the process makes a copy of the name. the device name needs to be stable. */
Process (unsigned long m_inode, const char * m_devicename, const char * m_name = NULL) Process (unsigned long m_inode, const char * m_devicename, const char * m_name = NULL)
{ {
//std::cout << "ARN: Process created with dev " << m_devicename << std::endl; //std::cout << "ARN: Process created with dev " << m_devicename << std::endl;
@@ -78,7 +78,7 @@ public:
else else
name = strdup(m_name); name = strdup(m_name);
devicename = strdup(m_devicename); devicename = m_devicename;
connections = NULL; connections = NULL;
pid = 0; pid = 0;
uid = 0; uid = 0;
@@ -90,14 +90,13 @@ public:
~Process () ~Process ()
{ {
free (name); free (name);
free (devicename);
if (DEBUG) if (DEBUG)
std::cout << "PROC: Process deleted at " << this << std::endl; std::cout << "PROC: Process deleted at " << this << std::endl;
} }
int getLastPacket (); int getLastPacket ();
char * name; char * name;
char * devicename; const char * devicename;
int pid; int pid;
unsigned long inode; unsigned long inode;