Changeset 69

Show
Ignore:
Timestamp:
12/27/05 14:19:29 (3 years ago)
Author:
mrowe
Message:

Fix several nasty memory management issues in the SSHKeychain class, including a leak in -[SSHKeychain setAgentSocketPath:]. Closes #30.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Libs/SSHKeychain.m

    r68 r69  
    8181        currentKeychain = nil; 
    8282 
    83         int i; 
    84         for(i=0; i < [keychain count]; i++) 
    85         { 
    86                 [[keychain objectAtIndex:i] release]; 
    87         } 
    88  
    89         [keychainLock lock]; 
    90  
     83        [keychainLock lock]; 
    9184        [keychain release]; 
    92         keychain = nil
    93  
    94         [keychainLock unlock]; 
    95  
    96         [addingKeysLock dealloc]; 
    97         [lastAddedLock dealloc]; 
     85        [keychainLock unlock]
     86 
     87        [keychainLock release]; 
     88        [addingKeysLock release]; 
     89        [lastAddedLock release]; 
     90        [agentSocketPath release]; 
    9891         
    9992        [super dealloc]; 
     
    132125- (void)setAgentSocketPath:(NSString *)path 
    133126{ 
    134         agentSocketPath = [[NSString stringWithString:path] retain]; 
     127        NSString *oldAgentSocketPath = agentSocketPath; 
     128        agentSocketPath = [path copy]; 
     129        [oldAgentSocketPath release]; 
    135130} 
    136131