Fixed memory leak

main
anulax1225 ago%!(EXTRA string=11 months)
parent 35d681ed21
commit a0273cc20d
  1. 22
      src/bakatools/json/node.cpp
  2. 2
      src/bakatools/json/node.h
  3. 2
      src/bakatools/string/string_tools.h

@ -1,6 +1,28 @@
#include "node.h"
namespace Bk::Json
{
Node::~Node()
{
switch(type)
{
case Type::OBJECT:
{
delete values.object;
break;
}
case Type::LIST:
{
delete values.list;
break;
}
case Type::STRING:
{
delete values.s;
break;
}
}
}
std::string Node::to_string(int indent)
{
std::string space_string = std::string(indent, ' ');

@ -23,6 +23,8 @@ namespace Bk::Json
NULL_TYPE
};
~Node();
Type get_type() { return type; }
bool is_type(Type type) { return type == this->type; }

@ -1,6 +1,6 @@
#pragma once
#include <bakatools.h>
#include <bakatoolspch.h>
#include "format.h"
namespace Bk::Tools {

Loading…
Cancel
Save