[Groonga-commit] groonga/groonga [master] fix a memory leak.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 3月 13日 (日) 19:48:37 JST


Kouhei Sutou	2011-03-13 10:48:37 +0000 (Sun, 13 Mar 2011)

  New Revision: b278152938d5dcf740473ddc85c09c8cd827df6d

  Log:
    fix a memory leak.

  Modified files:
    test/unit/core/test-text.c

  Modified: test/unit/core/test-text.c (+9 -4)
===================================================================
--- test/unit/core/test-text.c    2011-03-13 10:46:06 +0000 (a283827)
+++ test/unit/core/test-text.c    2011-03-13 10:48:37 +0000 (f6a1732)
@@ -55,10 +55,15 @@ cut_teardown(void)
 void
 test_time2rfc1123(void)
 {
-  grn_obj t;
-  GRN_TEXT_INIT(&t, 0);
-  grn_text_time2rfc1123(&context, &t, 1243433233);
-  cut_assert_equal_memory("Wed, 27 May 2009 14:07:13 GMT", 29, GRN_TEXT_VALUE(&t), GRN_TEXT_LEN(&t));
+  grn_obj rfc1123;
+  const gchar *dupped_rfc1123;
+
+  GRN_TEXT_INIT(&rfc1123, 0);
+  grn_text_time2rfc1123(&context, &rfc1123, 1243433233);
+  dupped_rfc1123 = cut_take_strndup(GRN_TEXT_VALUE(&rfc1123),
+                                    GRN_TEXT_LEN(&rfc1123));
+  grn_obj_unlink(&context, &rfc1123);
+  cut_assert_equal_string("Wed, 27 May 2009 14:07:13 GMT", dupped_rfc1123);
 }
 
 void




Groonga-commit メーリングリストの案内
Back to archive index