Commit e0fe76e4 authored by Alessio Netti's avatar Alessio Netti
Browse files

dcdbpusher: fixes to SNMPConnection entity

- Fixed a memory leak when inspecting error messages
- Relaxed class methods to enable inheritance
parent 8f750bae
......@@ -105,8 +105,8 @@ void SNMPConnection::execOnInit() {
snmp_error(&_snmpSession, &liberr, &syserr, &errstr);
if (liberr || syserr) {
LOG(error) << "SNMP: Error initializing session: " + std::string(errstr);
free(errstr);
}
free(errstr);
_snmpSession.version = _version;
_snmpSession.peername = strdup(_name.c_str());
......@@ -177,7 +177,7 @@ bool SNMPConnection::open() {
free(errstr);
return false;
}
free(errstr);
return true;
}
......
......@@ -155,12 +155,12 @@ class SNMPConnection : public EntityInterface {
}
long int getVersion() const { return _version; }
void printEntityConfig(LOG_LEVEL ll, unsigned int leadingSpaces) final override;
void printEntityConfig(LOG_LEVEL ll, unsigned int leadingSpaces) override;
/**
* Initializes the connection. Must be called once before the connection can be used
*/
void execOnInit() final override;
void execOnInit() override;
/**
* Open SNMP Session. Must be called once before issuing a get() call.
......@@ -182,7 +182,7 @@ class SNMPConnection : public EntityInterface {
*/
int64_t get(const oid *const OID, size_t OIDLen);
private:
protected:
std::string _snmpCommunity;
std::string _oidPrefix;
std::string _username;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment