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

libdcdb: fixing de-allocation of Cassandra resources in SensorConfig

parent 92c277d0
......@@ -994,6 +994,7 @@ SCError SensorConfigImpl::getPublicSensorByName(PublicSensor& sensor, const char
connection->printError(future);
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
return SC_UNKNOWNERROR;
} else {
const CassResult* result = cass_future_get_result(future);
......@@ -1094,7 +1095,7 @@ SCError SensorConfigImpl::getPublicSensorByName(PublicSensor& sensor, const char
cass_iterator_free(iterator);
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
return SC_UNKNOWNSENSOR;
}
cass_result_free(result);
......@@ -1226,6 +1227,11 @@ SCError SensorConfigImpl::isVirtual(bool& isVirtual, std::string publicName)
isVirtual = isVirtual_ ? true : false;
}
else {
cass_result_free(result);
cass_iterator_free(iterator);
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
return SC_UNKNOWNSENSOR;
}
......@@ -1297,6 +1303,11 @@ SCError SensorConfigImpl::getSensorPattern(std::string& pattern, std::string pub
pattern = std::string(pattern_cstr, pattern_len);
}
else {
cass_result_free(result);
cass_iterator_free(iterator);
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
return SC_UNKNOWNSENSOR;
}
......@@ -1447,6 +1458,7 @@ SCError SensorConfigImpl::setSensorScalingFactor(std::string publicName, double
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1470,6 +1482,7 @@ SCError SensorConfigImpl::setSensorScalingFactor(std::string publicName, double
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1493,6 +1506,7 @@ SCError SensorConfigImpl::setSensorUnit(std::string publicName, std::string unit
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1516,6 +1530,7 @@ SCError SensorConfigImpl::setSensorUnit(std::string publicName, std::string unit
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1539,6 +1554,7 @@ SCError SensorConfigImpl::setSensorMask(std::string publicName, uint64_t mask)
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1562,6 +1578,7 @@ SCError SensorConfigImpl::setSensorMask(std::string publicName, uint64_t mask)
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1637,6 +1654,7 @@ SCError SensorConfigImpl::clearOperations(std::string publicName)
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1659,6 +1677,7 @@ SCError SensorConfigImpl::clearOperations(std::string publicName)
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1696,6 +1715,7 @@ SCError SensorConfigImpl::setTimeToLive(std::string publicName, uint64_t ttl)
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1719,6 +1739,7 @@ SCError SensorConfigImpl::setTimeToLive(std::string publicName, uint64_t ttl)
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1759,6 +1780,7 @@ SCError SensorConfigImpl::setVirtualSensorExpression(std::string publicName, std
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1782,6 +1804,7 @@ SCError SensorConfigImpl::setVirtualSensorExpression(std::string publicName, std
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1820,6 +1843,7 @@ SCError SensorConfigImpl::setVirtualSensorTZero(std::string publicName, TimeStam
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1843,6 +1867,7 @@ SCError SensorConfigImpl::setVirtualSensorTZero(std::string publicName, TimeStam
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......@@ -1881,6 +1906,7 @@ SCError SensorConfigImpl::setSensorInterval(std::string publicName, uint64_t int
rc = cass_future_error_code(future);
if (rc != CASS_OK) {
connection->printError(future);
cass_future_free(future);
return SC_UNKNOWNERROR;
}
......@@ -1904,6 +1930,7 @@ SCError SensorConfigImpl::setSensorInterval(std::string publicName, uint64_t int
error = SC_OK;
}
cass_future_free(future);
cass_statement_free(statement);
cass_prepared_free(prepared);
......
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