[Groonga-commit] groonga/groonga at fc1680f [master] ii: add NULL check on building index

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jun 29 15:30:43 JST 2016


Kouhei Sutou	2016-06-29 15:30:43 +0900 (Wed, 29 Jun 2016)

  New Revision: fc1680f846404f81026f3f88b2a29ad6ba3dcf7f
  https://github.com/groonga/groonga/commit/fc1680f846404f81026f3f88b2a29ad6ba3dcf7f

  Message:
    ii: add NULL check on building index

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+8 -0)
===================================================================
--- lib/ii.c    2016-06-29 15:29:27 +0900 (5cf0fc3)
+++ lib/ii.c    2016-06-29 15:30:43 +0900 (2e5cfe3)
@@ -11224,6 +11224,14 @@ grn_ii_builder_register_chunks(grn_ctx *ctx, grn_ii_builder *builder)
   builder->buf.chunk_offset += builder->chunk.enc_offset;
 
   a = array_get(ctx, builder->ii, builder->chunk.tid);
+  if (!a) {
+    ERR(GRN_NO_MEMORY_AVAILABLE,
+        "[ii][builder][chunk][register] "
+        "failed to allocate an array in segment: tid=<%u>: max_n_segments=<%u>",
+        builder->chunk.tid,
+        builder->ii->seg->header->max_segment);
+    return ctx->rc;
+  }
   a[0] = SEG2POS(builder->buf.buf_id,
                  sizeof(buffer_header) + buf_tid * sizeof(buffer_term));
   a[1] = builder->df;
-------------- next part --------------
HTML����������������������������...
下載 



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