From 227f8bddd29f760e26258e8dab849bb674e877dc Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Thu, 15 Mar 2012 23:30:38 +0000 Subject: [PATCH] we don't need to strdup the device name --- process.cpp | 2 +- process.h | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/process.cpp b/process.cpp index 4d2923d..65c116c 100644 --- a/process.cpp +++ b/process.cpp @@ -58,7 +58,7 @@ extern std::map conninode; * * unknown TCP traffic * * UDP 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 * unknownudp; diff --git a/process.h b/process.h index 3fbf0e5..d33db42 100644 --- a/process.h +++ b/process.h @@ -65,7 +65,7 @@ private: class Process { 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) { //std::cout << "ARN: Process created with dev " << m_devicename << std::endl; @@ -78,7 +78,7 @@ public: else name = strdup(m_name); - devicename = strdup(m_devicename); + devicename = m_devicename; connections = NULL; pid = 0; uid = 0; @@ -90,14 +90,13 @@ public: ~Process () { free (name); - free (devicename); if (DEBUG) std::cout << "PROC: Process deleted at " << this << std::endl; } int getLastPacket (); char * name; - char * devicename; + const char * devicename; int pid; unsigned long inode;