You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/12/11 15:11:43 UTC

svn commit: r1420181 - /httpd/httpd/trunk/modules/lua/lua_vmprep.c

Author: humbedooh
Date: Tue Dec 11 14:11:41 2012
New Revision: 1420181

URL: http://svn.apache.org/viewvc?rev=1420181&view=rev
Log:
lua_vmprep.c: Additional check to see if the resource list was successfully created, so we don't end up trying to fetch a non-existent resource list when we use the 'server' option for the LuaScope directive.

Modified:
    httpd/httpd/trunk/modules/lua/lua_vmprep.c

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=1420181&r1=1420180&r2=1420181&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Tue Dec 11 14:11:41 2012
@@ -372,6 +372,7 @@ static apr_status_t server_vm_construct(
 {
     lua_State* L;
     ap_lua_server_spec* spec = apr_pcalloc(pool, sizeof(ap_lua_server_spec));
+    *resource = NULL;
     if (vm_construct(&L, params, pool) == APR_SUCCESS) {
         spec->finfo = apr_pcalloc(pool, sizeof(ap_lua_finfo));
         if (L != NULL) {
@@ -415,15 +416,18 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua
         }
         if (L == NULL) {
             ap_lua_vm_spec* server_spec = copy_vm_spec(r->server->process->pool, spec);
-            apr_reslist_create(&reslist, spec->vm_min, spec->vm_max, spec->vm_max, 0, 
+            if (
+                    apr_reslist_create(&reslist, spec->vm_min, spec->vm_max, spec->vm_max, 0, 
                                 (apr_reslist_constructor) server_vm_construct, 
                                 (apr_reslist_destructor) server_cleanup_lua, 
-                                server_spec, r->server->process->pool);
-            apr_pool_userdata_set(reslist, hash, NULL,
-                                        r->server->process->pool);
-            if (apr_reslist_acquire(reslist, (void**) &sspec) == APR_SUCCESS) {
-                L = sspec->L;
-                cache_info = sspec->finfo;
+                                server_spec, r->server->process->pool)
+                    == APR_SUCCESS && reslist != NULL) {
+                apr_pool_userdata_set(reslist, hash, NULL,
+                                            r->server->process->pool);
+                if (apr_reslist_acquire(reslist, (void**) &sspec) == APR_SUCCESS) {
+                    L = sspec->L;
+                    cache_info = sspec->finfo;
+                }
             }
         }
 #if APR_HAS_THREADS