mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vkgen] Plug a pile of ruamoko memory leaks
While the previous cleanup took care of the C side, it turns out vkgen was leaking property list items all over the place, but they were cleaned up by the shutdown code.
This commit is contained in:
parent
7d4c1d79b1
commit
68b5cd89d2
4 changed files with 41 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <PropertyList.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vkfieldarray.h"
|
||||
#include "vkfieldtype.h"
|
||||
|
@ -17,11 +18,19 @@
|
|||
PLItem *desc = [item getObjectForKey:"type"];
|
||||
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
|
||||
|
||||
value_field = [[item getObjectForKey:"values"] string];
|
||||
size_field = [[item getObjectForKey:"size"] string];
|
||||
value_field = str_hold ([[item getObjectForKey:"values"] string]);
|
||||
size_field = str_hold ([[item getObjectForKey:"size"] string]);
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[type release];
|
||||
str_free (value_field);
|
||||
str_free (size_field);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-writeParseData
|
||||
{
|
||||
fprintf (output_file, "static parse_array_t parse_%s_%s_data = {\n",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <PropertyList.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vkfieldreadonly.h"
|
||||
#include "vkfieldtype.h"
|
||||
|
@ -17,10 +18,17 @@
|
|||
PLItem *desc = [item getObjectForKey:"type"];
|
||||
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
|
||||
|
||||
value_field = [[item getObjectForKey:"value"] string];
|
||||
value_field = str_hold ([[item getObjectForKey:"value"] string]);
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[type release];
|
||||
str_free (value_field);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-writeParseData
|
||||
{
|
||||
return self;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <PropertyList.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vkfieldsingle.h"
|
||||
#include "vkfieldtype.h"
|
||||
|
@ -17,10 +18,17 @@
|
|||
PLItem *desc = [item getObjectForKey:"type"];
|
||||
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
|
||||
|
||||
value_field = [[item getObjectForKey:"value"] string];
|
||||
value_field = str_hold ([[item getObjectForKey:"value"] string]);
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[type release];
|
||||
str_free (value_field);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-writeParseData
|
||||
{
|
||||
fprintf (output_file, "static parse_single_t parse_%s_%s_data = {\n",
|
||||
|
|
|
@ -131,6 +131,12 @@ get_object_key (void *obj, void *unused)
|
|||
return [(id)obj name];
|
||||
}
|
||||
|
||||
static void
|
||||
free_object (void *obj, void *unused)
|
||||
{
|
||||
[(id)obj release];
|
||||
}
|
||||
|
||||
void
|
||||
usage (string name)
|
||||
{
|
||||
|
@ -181,7 +187,7 @@ main(int argc, string *argv)
|
|||
}
|
||||
queue = [[Array array] retain];
|
||||
output_types = [[Array array] retain];
|
||||
available_types = Hash_NewTable (127, get_object_key, nil, nil);
|
||||
available_types = Hash_NewTable (127, get_object_key, free_object, nil);
|
||||
processed_types = Hash_NewTable (127, get_string_key, nil, nil);
|
||||
scan_types ();
|
||||
|
||||
|
@ -258,5 +264,10 @@ main(int argc, string *argv)
|
|||
Qclose (header_file);
|
||||
Hash_DelTable (available_types);
|
||||
[plist release];
|
||||
[search release];
|
||||
[handles release];
|
||||
[parse release];
|
||||
[queue release];
|
||||
[output_types release];
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue