Skip to content

Commit

Permalink
Additional Mac cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
simonemainardi committed Jan 25, 2019
1 parent 4dd3f55 commit 94d66be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions include/Mac.h
Expand Up @@ -35,10 +35,9 @@ class Mac : public GenericHashEntry {
MacStats *stats, *stats_shadow;
time_t last_stats_reset;

/* Mac data: update Mac::deleteMacData when adding new fields */
char *fingerprint;
const char *model;
const char *ssid;
char * fingerprint;
char * model;
char * ssid;
OperatingSystem os;
bool source_mac, dhcpHost;
DeviceType device_type;
Expand Down Expand Up @@ -120,11 +119,9 @@ class Mac : public GenericHashEntry {
void updateHostPool(bool isInlineCall);
inline void setOperatingSystem(OperatingSystem _os) { os = _os; }
inline OperatingSystem getOperatingSystem() { return(os); }
inline char* getFingerprint() { return(fingerprint); }
void inlineSetModel(const char * const m);
void inlineSetFingerprint(const char * const f);
void inlineSetSSID(const char * const s);
inline char* getSSID() { return((char*)ssid); }
inline u_int16_t get_host_pool() { return(host_pool_id); }

inline void requestStatsReset() { stats_reset_requested = true; };
Expand Down
6 changes: 3 additions & 3 deletions src/Mac.cpp
Expand Up @@ -140,8 +140,8 @@ Mac::~Mac() {
iface->getHostPools()->getNumPoolL2Devices(get_host_pool()));
#endif

if(model) free((void*)model);
if(ssid) free((void*)ssid);
if(model) free(model);
if(ssid) free(ssid);
if(fingerprint) free(fingerprint);
if(stats) delete(stats);
if(stats_shadow) delete(stats_shadow);
Expand Down Expand Up @@ -524,7 +524,7 @@ void Mac::updateStats(struct timeval *tv) {
void Mac::deleteMacData() {
os = os_unknown;
source_mac = dhcpHost = false;
device_type = device_unknown; /* note: put after setSSID, otherwise will be overwritten */
device_type = device_unknown;
#ifdef NTOPNG_PRO
captive_portal_notified = false;
#endif
Expand Down

0 comments on commit 94d66be

Please sign in to comment.