[Groonga-commit] groonga/groonga at 250daac [master] Fix allocated size

Back to archive index

Kouhei Sutou null+****@clear*****
Mon May 28 14:15:24 JST 2018


Kouhei Sutou	2018-05-28 14:15:24 +0900 (Mon, 28 May 2018)

  New Revision: 250daac0d97323cbf696a2066e7d7c151b312fa4
  https://github.com/groonga/groonga/commit/250daac0d97323cbf696a2066e7d7c151b312fa4

  Message:
    Fix allocated size

  Modified files:
    lib/normalizer.c

  Modified: lib/normalizer.c (+3 -2)
===================================================================
--- lib/normalizer.c    2018-05-28 14:05:24 +0900 (fffbc90ad)
+++ lib/normalizer.c    2018-05-28 14:15:24 +0900 (77fc9763e)
@@ -1121,7 +1121,7 @@ utf8_normalize(grn_ctx *ctx,
   }
   cp = nstr->ctypes;
   if (options->report_source_offset) {
-    if (!(nstr->offsets = GRN_MALLOC(ds + 1))) {
+    if (!(nstr->offsets = GRN_MALLOC(sizeof(uint64_t) * (ds + 1)))) {
       if (nstr->checks) { GRN_FREE(nstr->checks); nstr->checks = NULL; }
       if (nstr->ctypes) { GRN_FREE(nstr->ctypes); nstr->ctypes = NULL; }
       GRN_FREE(nstr->normalized); nstr->normalized = NULL;
@@ -1225,7 +1225,8 @@ utf8_normalize(grn_ctx *ctx,
           }
           if (offsets) {
             uint64_t *new_offsets;
-            if (!(new_offsets = GRN_REALLOC(nstr->offsets, ds + 1))) {
+            if (!(new_offsets = GRN_REALLOC(nstr->offsets,
+                                            sizeof(uint64_t) * (ds + 1)))) {
               GRN_FREE(nstr->offsets); nstr->offsets = NULL;
               if (nstr->ctypes) { GRN_FREE(nstr->ctypes); nstr->ctypes = NULL; }
               if (nstr->checks) { GRN_FREE(nstr->checks); nstr->checks = NULL; }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180528/b2637a96/attachment.htm 



More information about the Groonga-commit mailing list
Back to archive index