From fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 10:15:01 +0100 Subject: giga refactor, fix ALL the leaks --- src/util/config/config.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/util/config/config.cpp') diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp index a41e455..00a2512 100644 --- a/src/util/config/config.cpp +++ b/src/util/config/config.cpp @@ -30,9 +30,7 @@ inline void trim_whitespace( char* buf ) { } inline void init_cfg_node( CFG_NODE* node, const char* name, CFG_NODE* parent, U8 type ) { - memset( node->name, 0, sizeof(node->name) ); - strcpy( node->name, name ); - node->name[sizeof(node->name) - 1] = '\0'; + node->name = name; node->parent = parent; if( parent ) ( (CFG_SECTION*)parent )->children.push( node ); @@ -290,17 +288,12 @@ STAT cfg_save( CFG_SECTION* root, const char* path ) { if( !f ) return STAT_ERR; - char* buf = (char*)malloc( 999999 ); - buf[0] = 0; CFG_SERIALIZER s; s.tabc = 0; s.f = f; - cfg_serialize_section( &s, (CFG_NODE*)root, buf ); - U32 len = strlen( buf ); - - fwrite( buf, 1, len, f ); - free( buf ); + STR buf = cfg_serialize_section( &s, (CFG_NODE*)root ); + fwrite( buf, 1, buf.size, f ); fclose( f ); return STAT_OK; -- cgit v1.2.3