[users@httpd] Potential Bug in mod_file_cache.c
I observed a code clone in the following files. The second and third functions type cast the object after allocation using apr_palloc while the first function does not. I wonder if this is necessary in the function create_server_config. Hope it helps. function : create_server_config @ (file: httpd-2.4.2/modules/cache/mod_file_cache.c, line: 119)~122 a_server_config *sconf = apr_palloc(p, sizeof(*sconf)); sconf-fileht = apr_hash_make(p); return sconf; function : create_setenvif_config @ (file: httpd-2.4.2/modules/metadata/mod_setenvif.c, line: 135)~138 sei_cfg_rec *new = (sei_cfg_rec *) apr_palloc(p, sizeof(sei_cfg_rec)); new-conditionals = apr_array_make(p, 20, sizeof(sei_entry)); return (void *) new; function : lb_hb_create_config @ (file: httpd-2.4.2/modules/proxy/balancers/mod_lbmethod_heartbeat.c, line: 408)~412 lb_hb_ctx_t *ctx = (lb_hb_ctx_t *) apr_palloc(p, sizeof(lb_hb_ctx_t)); ctx-path = ap_server_root_relative(p, logs/hb.dat); return ctx;
[users@httpd] Potential Bug in mpm_common.c
I observed a code clone in the following files. In the function ap_mpm_set_max_mem_free the variable value has to be multiplied by 1024 before exit while ap_mpm_set_thread_stacksize does not perform this operation. I wonder if this is necessary. Hope it helps. function : ap_mpm_set_max_mem_free @ (file: httpd-2.4.2/server/mpm_common.c, line: 376)~388 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } value = strtol(arg, NULL, 10); if (value 0 || errno == ERANGE) return apr_pstrcat(cmd-pool, Invalid MaxMemFree value: , arg, NULL); ap_max_mem_free = (apr_uint32_t)value * 1024; return NULL; function : ap_mpm_set_thread_stacksize @ (file: httpd-2.4.2/server/mpm_common.c, line: 395)~407 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } value = strtol(arg, NULL, 10); if (value 0 || errno == ERANGE) return apr_pstrcat(cmd-pool, Invalid ThreadStackSize value: , arg, NULL); ap_thread_stacksize = (apr_size_t)value; return NULL;