diff options
| author | Aura Linden <aura@lindenlab.com> | 2012-12-16 17:45:55 -0800 | 
|---|---|---|
| committer | Aura Linden <aura@lindenlab.com> | 2012-12-16 17:45:55 -0800 | 
| commit | c1db961ab9b7aa9c0dd43cadf850b7527b77e95b (patch) | |
| tree | 29b2b1fa65a68c0f54f0bfc2824a6064b81115c2 /indra/llvfs | |
| parent | 3a72577f397a3cd3ebcb2d3e80000716bf0befec (diff) | |
Fixed small one-time memory leaks.
Diffstat (limited to 'indra/llvfs')
| -rw-r--r-- | indra/llvfs/llvfs_objc.mm | 23 | 
1 files changed, 20 insertions, 3 deletions
| diff --git a/indra/llvfs/llvfs_objc.mm b/indra/llvfs/llvfs_objc.mm index 16cfefda26..4f9e2f81e9 100644 --- a/indra/llvfs/llvfs_objc.mm +++ b/indra/llvfs/llvfs_objc.mm @@ -32,16 +32,22 @@  std::string* getSystemTempFolder()  { +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];      NSString * tempDir = NSTemporaryDirectory();      if (tempDir == nil)          tempDir = @"/tmp"; -    return ( new std::string([tempDir UTF8String]) ); +    std::string *result = ( new std::string([tempDir UTF8String]) ); +    [pool release]; +     +    return result;  }  //findSystemDirectory scoped exclusively to this file.   std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory,                                     NSSearchPathDomainMask domainMask)  { +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +          std::string *result;      NSString *path = nil; @@ -60,19 +66,30 @@ std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory,          result = new std::string([path UTF8String]);              } +    [pool release];      return result;  }  std::string* getSystemExecutableFolder()  { +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +      NSString *bundlePath = [[NSBundle mainBundle] executablePath]; -    return (new std::string([bundlePath UTF8String]));   +    std::string *result = (new std::string([bundlePath UTF8String]));   +    [pool release]; + +    return result;  }  std::string* getSystemResourceFolder()  { +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +      NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; -    return (new std::string([bundlePath UTF8String])); +    std::string *result = (new std::string([bundlePath UTF8String])); +    [pool release]; +     +    return result;  }  std::string* getSystemCacheFolder() | 
