Fix some valgrind errors

by 0x5DE892: _c_ResourceManager__paths (ResourceManager.m:458)
by 0x4B45D2: _i_PlayerEntity_Scripting_removeAllCargo_ (PlayerEntityLegacyScriptEngine.m:1410)
by 0x64FF8D: _i_OOALBufferedSound__initWithDecoder_ (OOALBufferedSound.m:64)
by 0x45A69A: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1803)
by 0x45AD59: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1878)
by 0x64C5A2: _i_OOSoundSourcePool__initWithCount_minRepeatTime_ (OOSoundSourcePool.m:76)
by 0x6628FA: _i_HeadUpDisplay__initWithDictionary_inFile_ (HeadUpDisplay.m:296)
by 0x4C673C: _i_PlayerEntity_Sound_setUpSound (PlayerEntitySound.m:86)
by 0x4598FE: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1683)
by 0x45999F: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1688)
by 0x459FAD: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1733)
by 0x4599F8: _i_PlayerEntity__setUpAndConfirmOK_saveGame_ (PlayerEntity.m:1690)
by 0x66218B: _i_HeadUpDisplay__initWithDictionary_inFile_ (HeadUpDisplay.m:230)
by 0x6001B0: InitOOJSManifest (OOJSManifest.m:203)
This commit is contained in:
cim 2014-08-21 18:27:41 +01:00
parent e4e6466279
commit 716c9b7ca7
8 changed files with 19 additions and 2 deletions

View File

@ -1172,6 +1172,7 @@ static GLfloat sBaseMass = 0.0;
[self initialiseMissionDestinations:newDestinations andLegacy:legacyDestinations]; [self initialiseMissionDestinations:newDestinations andLegacy:legacyDestinations];
// shipyard // shipyard
DESTROY(shipyard_record);
shipyard_record = [[dict oo_dictionaryForKey:@"shipyard_record"] mutableCopy]; shipyard_record = [[dict oo_dictionaryForKey:@"shipyard_record"] mutableCopy];
if (shipyard_record == nil) shipyard_record = [[NSMutableDictionary alloc] init]; if (shipyard_record == nil) shipyard_record = [[NSMutableDictionary alloc] init];
@ -1539,6 +1540,7 @@ static GLfloat sBaseMass = 0.0;
target_memory_index = 0; target_memory_index = 0;
DESTROY(dockingReport);
dockingReport = [[NSMutableString alloc] init]; dockingReport = [[NSMutableString alloc] init];
[hud resetGuis:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:nil], @"message_gui", [hud resetGuis:[NSDictionary dictionaryWithObjectsAndKeys:[NSDictionary dictionaryWithObjectsAndKeys:nil], @"message_gui",
[NSDictionary dictionaryWithObjectsAndKeys:nil], @"comm_log_gui", nil]]; [NSDictionary dictionaryWithObjectsAndKeys:nil], @"comm_log_gui", nil]];
@ -1680,13 +1682,16 @@ static GLfloat sBaseMass = 0.0;
[reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY]; [reputation oo_setInteger:0 forKey:PARCEL_BAD_KEY];
[reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY]; [reputation oo_setInteger:MAX_CONTRACT_REP forKey:PARCEL_UNKNOWN_KEY];
DESTROY(roleWeights);
roleWeights = [[NSMutableArray alloc] initWithCapacity:8]; roleWeights = [[NSMutableArray alloc] initWithCapacity:8];
for (i = 0 ; i < 8 ; i++) for (i = 0 ; i < 8 ; i++)
{ {
[roleWeights addObject:@"player-unknown"]; [roleWeights addObject:@"player-unknown"];
} }
DESTROY(roleWeightFlags);
roleWeightFlags = [[NSMutableDictionary alloc] init]; roleWeightFlags = [[NSMutableDictionary alloc] init];
DESTROY(roleSystemList);
roleSystemList = [[NSMutableArray alloc] initWithCapacity:32]; roleSystemList = [[NSMutableArray alloc] initWithCapacity:32];
energy = 256; energy = 256;
@ -1793,6 +1798,7 @@ static GLfloat sBaseMass = 0.0;
max_cargo = 20; // will be reset later max_cargo = 20; // will be reset later
DESTROY(shipCommodityData);
shipCommodityData = [[[ResourceManager dictionaryFromFilesNamed:@"commodities.plist" inFolder:@"Config" andMerge:YES] objectForKey:@"default"] retain]; shipCommodityData = [[[ResourceManager dictionaryFromFilesNamed:@"commodities.plist" inFolder:@"Config" andMerge:YES] objectForKey:@"default"] retain];
// set up missiles // set up missiles
@ -2029,6 +2035,7 @@ static GLfloat sBaseMass = 0.0;
DESTROY(_fastEquipmentA); DESTROY(_fastEquipmentA);
DESTROY(_fastEquipmentB); DESTROY(_fastEquipmentB);
DESTROY(eqScripts);
DESTROY(worldScripts); DESTROY(worldScripts);
DESTROY(worldScriptsRequiringTickle); DESTROY(worldScriptsRequiringTickle);
DESTROY(mission_variables); DESTROY(mission_variables);

View File

@ -108,6 +108,7 @@ static const Vector kAfterburner2Position = { 0.1f, 0.0f, -1.0f };
DESTROY(sWarningSoundPool); DESTROY(sWarningSoundPool);
DESTROY(sWeaponSoundPool); DESTROY(sWeaponSoundPool);
DESTROY(sDamageSoundPool); DESTROY(sDamageSoundPool);
DESTROY(sMiscSoundPool);
} }

View File

@ -307,11 +307,13 @@ OOINLINE void GLColorWithOverallAlpha(const GLfloat *color, GLfloat alpha)
- (void) dealloc - (void) dealloc
{ {
DESTROY(legendArray); DESTROY(legendArray);
DESTROY(dialArray); DESTROY(dialArray);
DESTROY(mfdArray);
DESTROY(hudName); DESTROY(hudName);
DESTROY(deferredHudName); DESTROY(deferredHudName);
DESTROY(propertiesReticleTargetSensitive); DESTROY(propertiesReticleTargetSensitive);
DESTROY(_crosshairOverrides); DESTROY(_crosshairOverrides);
DESTROY(_crosshairColor);
DESTROY(crosshairDefinition); DESTROY(crosshairDefinition);
DESTROY(_hiddenSelectors); DESTROY(_hiddenSelectors);

View File

@ -35,6 +35,7 @@ SOFTWARE.
{ {
free(_buffer); free(_buffer);
_buffer = NULL; _buffer = NULL;
DESTROY(_name);
[super dealloc]; [super dealloc];
} }

View File

@ -134,6 +134,9 @@ static NSString * const kVisualEffectDataCacheKey = @"visual effect data";
{ {
if (sSingleton != nil) if (sSingleton != nil)
{ {
/* CIM: 'release' doesn't work - the class definition
* overrides it, so this leaks memory. Needs a proper reset
* method for reloading the ship registry data instead */
[sSingleton release]; [sSingleton release];
sSingleton = nil; sSingleton = nil;

View File

@ -92,7 +92,8 @@ typedef struct OOSoundSourcePoolElement
{ {
[_sources[i].source release]; [_sources[i].source release];
} }
free(_sources);
[_lastKey release]; [_lastKey release];
[super dealloc]; [super dealloc];

View File

@ -259,6 +259,7 @@ static NSMutableDictionary *sStringCache;
} }
// validate default search paths // validate default search paths
DESTROY(sSearchPaths);
sSearchPaths = [NSMutableArray new]; sSearchPaths = [NSMutableArray new];
foreach(path, existingRootPaths) foreach(path, existingRootPaths)
{ {

View File

@ -200,6 +200,7 @@ void InitOOJSManifest(JSContext *context, JSObject *global)
} }
// EMMSTRAN: use NSMapTable. -- Ahruman 2011-02-10 // EMMSTRAN: use NSMapTable. -- Ahruman 2011-02-10
DESTROY(sManifestNameMap);
sManifestNameMap = [[NSMutableDictionary alloc] initWithDictionary:manifestNameMap]; sManifestNameMap = [[NSMutableDictionary alloc] initWithDictionary:manifestNameMap];
} }