You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ken Cheung <ms...@gmail.com> on 2012/06/14 08:46:26 UTC

[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;