From: Stefan Fritsch Date: Sat, 2 Oct 2010 15:04:08 +0000 (+0000) Subject: Use ptemp in some places to save some memory when parsing included config X-Git-Tag: 2.3.9~372 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10e73f91c7b47241221b54b410fc0acd9f855331;p=thirdparty%2Fapache%2Fhttpd.git Use ptemp in some places to save some memory when parsing included config files git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1003809 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/config.c b/server/config.c index a3d67f0b1d4..538a7268ec0 100644 --- a/server/config.c +++ b/server/config.c @@ -1704,13 +1704,13 @@ static const char *process_resource_config_nofnmatch(server_rec *s, const char *error; apr_status_t rv; - if (ap_is_directory(p, fname)) { + if (ap_is_directory(ptemp, fname)) { apr_dir_t *dirp; apr_finfo_t dirent; int current; apr_array_header_t *candidates = NULL; fnames *fnew; - char *path = apr_pstrdup(p, fname); + char *path = apr_pstrdup(ptemp, fname); if (++depth > AP_MAX_INCLUDE_DIR_DEPTH) { return apr_psprintf(p, "Directory %s exceeds the maximum include " @@ -1724,20 +1724,20 @@ static const char *process_resource_config_nofnmatch(server_rec *s, * entries here and store 'em away. Recall we need full pathnames * for this. */ - rv = apr_dir_open(&dirp, path, p); + rv = apr_dir_open(&dirp, path, ptemp); if (rv != APR_SUCCESS) { char errmsg[120]; return apr_psprintf(p, "Could not open config directory %s: %s", path, apr_strerror(rv, errmsg, sizeof errmsg)); } - candidates = apr_array_make(p, 1, sizeof(fnames)); + candidates = apr_array_make(ptemp, 1, sizeof(fnames)); while (apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp) == APR_SUCCESS) { /* strip out '.' and '..' */ if (strcmp(dirent.name, ".") && strcmp(dirent.name, "..")) { fnew = (fnames *) apr_array_push(candidates); - fnew->fname = ap_make_full_path(p, path, dirent.name); + fnew->fname = ap_make_full_path(ptemp, path, dirent.name); } } @@ -1889,10 +1889,10 @@ AP_DECLARE(const char *) ap_process_fnmatch_configs(server_rec *s, /* don't require conf/httpd.conf if we have a -C or -c switch */ if ((ap_server_pre_read_config->nelts || ap_server_post_read_config->nelts) - && !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) { + && !(strcmp(fname, ap_server_root_relative(ptemp, SERVER_CONFIG_FILE)))) { apr_finfo_t finfo; - if (apr_stat(&finfo, fname, APR_FINFO_LINK | APR_FINFO_TYPE, p) != APR_SUCCESS) + if (apr_stat(&finfo, fname, APR_FINFO_LINK | APR_FINFO_TYPE, ptemp) != APR_SUCCESS) return NULL; }