Fix all memory leaks

This commit is contained in:
olemorud
2023-04-24 23:44:17 +02:00
parent 3b7cc458fc
commit 2eeaa2171f
4 changed files with 69 additions and 20 deletions

View File

@@ -4,7 +4,7 @@
#include <stdbool.h> // bool
#define OBJ_SIZE 64
#define OBJ_SIZE 32
typedef struct obj_entry {
char const* key;
@@ -25,7 +25,7 @@ struct json_value {
enum json_type type;
union {
obj_t* object;
struct json_value** array;
struct json_value** array; // we need an array of pointers to allow null termination
char* string;
bool boolean;
double number;
@@ -34,8 +34,10 @@ struct json_value {
void* obj_at(obj_t m, char* const key);
bool obj_insert(obj_t m, char* const key, struct json_value* value);
void obj_delete(obj_t m);
void obj_delete(obj_t* m);
void print_json(struct json_value val, int indent);
void json_value_delete(struct json_value val);
#endif