--- groonga.c.orig	2015-06-27 16:07:46.000000000 -0700
+++ groonga.c	2015-06-27 16:08:29.000000000 -0700
@@ -101,6 +101,9 @@
   long flags = 0;
   grn_rc rc;
 
+	if (ctx == NULL) {
+		RETURN_FALSE;		/*	Unable to allocate memory for ctx	*/
+	}
 
   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags) == FAILURE) {
     return;
