[Groonga-commit] groonga/groonga at 458c5a1 [master] pat: check whether memory allocated or not

Back to archive index

naoa null+****@clear*****
Mon Feb 1 16:28:45 JST 2016


naoa	2016-02-01 16:28:45 +0900 (Mon, 01 Feb 2016)

  New Revision: 458c5a196bbc7134154249a82ebdf31b1f2a633c
  https://github.com/groonga/groonga/commit/458c5a196bbc7134154249a82ebdf31b1f2a633c

  Merged 2d929d3: Merge pull request #460 from naoa/pat-fussy-search

  Message:
    pat: check whether memory allocated or not

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+3 -0)
===================================================================
--- lib/pat.c    2016-02-01 16:24:36 +0900 (f46beb9)
+++ lib/pat.c    2016-02-01 16:28:45 +0900 (7185389)
@@ -1423,6 +1423,9 @@ grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat,
   }
   for (lx = 0; s < e && (len = grn_charlen(ctx, s, e)); s += len, lx++);
   dists = GRN_MALLOC((lx + 1) * (lx + max_distance + 1) * sizeof(uint16_t));
+  if (!dists) {
+    return GRN_NO_MEMORY_AVAILABLE;
+  }
 
   for (x = 0; x <= lx; x++) { DIST(x, 0) = x; }
   for (y = 0; y <= lx + max_distance ; y++) { DIST(0, y) = y; }
-------------- next part --------------
HTML����������������������������...
Download 



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