]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix memory leak warning.
authorJan Djärv <jan.h.d@swipnet.se>
Sun, 11 Aug 2013 15:05:13 +0000 (17:05 +0200)
committerJan Djärv <jan.h.d@swipnet.se>
Sun, 11 Aug 2013 15:05:13 +0000 (17:05 +0200)
* nsfns.m (Fns_convert_utf8_nfd_to_nfc): Allocate and release pool to
remove memory leak warnings.

src/ChangeLog
src/nsfns.m

index 58806f4e0b1f02dccb74385fdef43870817d99da..f8aea1dc83be5e4259160f4b21fe04d7323cf5c9 100644 (file)
@@ -1,5 +1,8 @@
 2013-08-11  Jan Djärv  <jan.h.d@swipnet.se>
 
+       * nsfns.m (Fns_convert_utf8_nfd_to_nfc): Allocate and release pool to
+       remove memory leak warnings.
+
        * nsterm.m (menu_pending_title, ns_get_pending_menu_title): Remove.
        (ns_check_menu_open): Handle menu == nil.  Remove assignment to
        menu_pending_title.
index 64db1b7fd0aeb2e6920e3029bb47a3e8741bd6e7..ba0dba8c7e7e81be3039e38cf9e05b58ed3d9c59 100644 (file)
@@ -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;
 }