updated minor memory management to avoid text corruption

This commit is contained in:
faraphel 2024-12-23 10:44:06 +01:00
parent 4e547635d8
commit 9c413c0edd
6 changed files with 17 additions and 15 deletions

View file

@ -9,14 +9,14 @@
namespace gns {
GnsNode::GnsNode(const GnsProject *project, std::string uuid, const std::vector<GnsPort>& ports) {
GnsNode::GnsNode(const GnsProject *project, const std::string& uuid, const std::vector<GnsPort>& ports) {
this->project = project;
this->uuid = std::move(uuid);
this->uuid = uuid;
this->ports = ports;
}
std::string GnsNode::getApiBase() const {
return this->project->getApiBase() + "nodes/" + this->uuid + "/";
return this->project->getApiBase() + "nodes/" + this->getUuid() + "/";
}
std::string GnsNode::getUuid() const {
@ -30,7 +30,7 @@ std::vector<GnsPort> GnsNode::getPorts() const {
void GnsNode::start() const {
// request the API endpoint
cpr::Url endpoint = this->getApiBase() + "start";
cpr::Response response = Post(endpoint);
const cpr::Response response = Post(endpoint);
// check for a valid response
if (response.error.code != cpr::ErrorCode::OK)