You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/09/10 21:04:37 UTC

svn commit: r813546 - in /httpd/mod_fcgid/trunk/modules/fcgid: fcgid_bridge.c fcgid_conf.c fcgid_proc_unix.c fcgid_proc_win.c fcgid_proctbl_win.c fcgid_spawn_ctl.c

Author: trawick
Date: Thu Sep 10 19:04:36 2009
New Revision: 813546

URL: http://svn.apache.org/viewvc?rev=813546&view=rev
Log:
stop checking for failures of apr_palloc(), apr_pcalloc(), and
apr_brigade_create()

Modified:
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_win.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Thu Sep 10 19:04:36 2009
@@ -314,12 +314,6 @@
     }
 
     bucket_ctx = apr_pcalloc(request_pool, sizeof(*bucket_ctx));
-    if (!bucket_ctx) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(),
-                     r->server,
-                     "mod_fcgid: apr_calloc bucket_ctx failed in handle_request function");
-        return HTTP_INTERNAL_SERVER_ERROR;
-    }
     bucket_ctx->ipc.connect_timeout = g_connect_timeout;
     bucket_ctx->ipc.communation_timeout = g_comm_timeout;
     bucket_ctx->ipc.request = r;
@@ -401,11 +395,6 @@
     /* Create brigade */
     brigade_stdout =
         apr_brigade_create(request_pool, r->connection->bucket_alloc);
-    if (!brigade_stdout) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(), r->server,
-                     "mod_fcgid: apr_brigade_create failed in handle_request function");
-        return HTTP_INTERNAL_SERVER_ERROR;
-    }
     APR_BRIGADE_INSERT_TAIL(brigade_stdout,
                             ap_bucket_fcgid_header_create(r->connection->
                                                           bucket_alloc,
@@ -478,12 +467,6 @@
     /* Create brigade for the request to fastcgi server */
     output_brigade =
         apr_brigade_create(request_pool, r->connection->bucket_alloc);
-    if (!output_brigade) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(),
-                     main_server,
-                     "mod_fcgid: can't alloc memory for output brigade");
-        return HTTP_INTERNAL_SERVER_ERROR;
-    }
 
     /* Build the begin request and environ request, append them to output_brigade */
     if (!build_begin_block
@@ -510,17 +493,15 @@
             apr_brigade_create(request_pool,
                                r->connection->bucket_alloc);
 
-        if (!input_brigade
-            || (rv = ap_get_brigade(r->input_filters, input_brigade,
-                                    AP_MODE_READBYTES,
-                                    APR_BLOCK_READ,
-                                    HUGE_STRING_LEN)) != APR_SUCCESS) {
+        if ((rv = ap_get_brigade(r->input_filters, input_brigade,
+                                 AP_MODE_READBYTES,
+                                 APR_BLOCK_READ,
+                                 HUGE_STRING_LEN)) != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_WARNING, rv,
                          main_server,
                          "mod_fcgid: can't get data from http client");
             apr_brigade_destroy(output_brigade);
-            if (input_brigade)
-                apr_brigade_destroy(input_brigade);
+            apr_brigade_destroy(input_brigade);
             return HTTP_INTERNAL_SERVER_ERROR;
         }
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Thu Sep 10 19:04:36 2009
@@ -621,8 +621,6 @@
     dirconfig->authenticator_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->authenticator_info));
-    if (!dirconfig->authenticator_info)
-        return "Can't alloc memory for authenticator_info";
     apr_cpystrn(dirconfig->authenticator_info->path, authenticator,
                 _POSIX_PATH_MAX);
     dirconfig->authenticator_info->inode = finfo.inode;
@@ -672,8 +670,6 @@
     dirconfig->authorizer_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->authorizer_info));
-    if (!dirconfig->authorizer_info)
-        return "Can't alloc memory for authorizer";
     apr_cpystrn(dirconfig->authorizer_info->path, authorizer,
                 _POSIX_PATH_MAX);
     dirconfig->authorizer_info->inode = finfo.inode;
@@ -723,8 +719,6 @@
     dirconfig->access_info =
         apr_pcalloc(cmd->server->process->pconf,
                     sizeof(*dirconfig->access_info));
-    if (!dirconfig->access_info)
-        return "Can't alloc memory for access";
     apr_cpystrn(dirconfig->access_info->path, access, _POSIX_PATH_MAX);
     dirconfig->access_info->inode = finfo.inode;
     dirconfig->access_info->deviceid = finfo.device;
@@ -806,8 +800,6 @@
     }
 
     wrapper = apr_pcalloc(cmd->server->process->pconf, sizeof(*wrapper));
-    if (!wrapper)
-        return "Can't alloc memory for wrapper";
 
     /* Get wrapper path */
     tmp = wrapperpath;

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c Thu Sep 10 19:04:36 2009
@@ -323,10 +323,10 @@
     }
 
     /* Prepare the fork */
-    if (!
-        (procnode->proc_id =
-         apr_pcalloc(procnode->proc_pool, sizeof(apr_proc_t)))
-|| (rv =
+    procnode->proc_id = apr_pcalloc(procnode->proc_pool, 
+                                    sizeof(apr_proc_t));
+    if (
+   (rv =
     apr_procattr_create(&procattr, procnode->proc_pool)) != APR_SUCCESS
 || (rv =
     apr_procattr_child_err_set(procattr,
@@ -540,8 +540,6 @@
         = (fcgid_namedpipe_handle *) apr_pcalloc(ipc_handle->request->pool,
                                                  sizeof
                                                  (fcgid_namedpipe_handle));
-    if (!ipc_handle->ipc_handle_info)
-        return APR_ENOMEM;
     handle_info = (fcgid_namedpipe_handle *) ipc_handle->ipc_handle_info;
     handle_info->handle_socket = socket(AF_UNIX, SOCK_STREAM, 0);
     apr_pool_cleanup_register(ipc_handle->request->pool,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c Thu Sep 10 19:04:36 2009
@@ -106,12 +106,6 @@
 
     /* Prepare finish event */
     finish_event = apr_palloc(procnode->proc_pool, sizeof(HANDLE));
-    if (!finish_event) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(),
-                     procinfo->main_server,
-                     "mod_fcgid: can't allocate finish event");
-        return APR_ENOMEM;
-    }
     *finish_event = CreateEvent(NULL, TRUE, FALSE, NULL);
     if (*finish_event == NULL
         || !SetHandleInformation(*finish_event, HANDLE_FLAG_INHERIT, TRUE))
@@ -165,9 +159,9 @@
     }
 
     /* Create process now */
-    if (!(procnode->proc_id = apr_pcalloc(procnode->proc_pool,
-                                          sizeof(apr_proc_t)))
-        || (rv = apr_procattr_create(&proc_attr, procnode->proc_pool))
+    procnode->proc_id = apr_pcalloc(procnode->proc_pool,
+                                    sizeof(apr_proc_t))
+    if ((rv = apr_procattr_create(&proc_attr, procnode->proc_pool))
                != APR_SUCCESS
         || (rv = apr_procattr_dir_set(proc_attr,
                      ap_make_dirstr_parent(procnode->proc_pool,
@@ -314,9 +308,6 @@
         (fcgid_namedpipe_handle *) apr_pcalloc(ipc_handle->request->pool,
                                                sizeof
                                                (fcgid_namedpipe_handle));
-    if (!ipc_handle->ipc_handle_info)
-        return APR_ENOMEM;
-
     handle_info = (fcgid_namedpipe_handle *) ipc_handle->ipc_handle_info;
 
     /* Prepare OVERLAPPED struct for non-block I/O */

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_win.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_win.c Thu Sep 10 19:04:36 2009
@@ -49,16 +49,7 @@
     }
 
     /* There is only one process in WinNT mpm, share memory is not necessary */
-    if ((_global_memory = ((fcgid_share *) apr_pcalloc(pconf,
-                                                       shmem_size))) ==
-        NULL) {
-        /* Fatal error */
-        ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(),
-                     main_server,
-                     "mod_fcgid: can't alloc memory for size %ld",
-                     shmem_size);
-        exit(1);
-    }
+    _global_memory = (fcgid_share *) apr_pcalloc(pconf, shmem_size);
 
     g_proc_array = _global_memory->procnode_array;
     g_global_share = &_global_memory->global;

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c?rev=813546&r1=813545&r2=813546&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c Thu Sep 10 19:04:36 2009
@@ -95,8 +95,6 @@
     } else {
         /* I can't find it, create one */
         current_node = apr_pcalloc(g_stat_pool, sizeof(*current_node));
-        if (!current_node)
-            return;
         current_node->deviceid = procnode->deviceid;
         current_node->inode = procnode->inode;
         current_node->share_grp_id = procnode->share_grp_id;