diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2013-08-11 17:05:13 +0200 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2013-08-11 17:05:13 +0200 |
commit | 423d3b3f9acf6b4d9f9a0b8a22a20809896117e4 (patch) | |
tree | 6ced5dbd51f0ca8f77a91bc7909ff95d45c6b7cf /src/nsfns.m | |
parent | d2d699ac519599385b2865627db065c0fbfd38f3 (diff) | |
download | emacs-423d3b3f9acf6b4d9f9a0b8a22a20809896117e4.tar.gz |
Fix memory leak warning.
* nsfns.m (Fns_convert_utf8_nfd_to_nfc): Allocate and release pool to
remove memory leak warnings.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r-- | src/nsfns.m | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 64db1b7fd0a..ba0dba8c7e7 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2035,13 +2035,17 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping, remove this. */ NSString *utfStr; + Lisp_Object ret; CHECK_STRING (str); - utfStr = [NSString stringWithUTF8String: SSDATA (str)]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + utfStr = [NSString stringWithUTF8String: SSDATA (str)]; #ifdef NS_IMPL_COCOA - utfStr = [utfStr precomposedStringWithCanonicalMapping]; + utfStr = [utfStr precomposedStringWithCanonicalMapping]; #endif - return build_string ([utfStr UTF8String]); + ret = build_string ([utfStr UTF8String]); + [pool release]; + return ret; } |