httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lai Yiu Fai <ccyf...@ust.hk>
Subject uninitialized shared memory in mod_auth_digest.c
Date Tue, 04 Jul 2006 02:31:35 GMT
I am writing a module which implements a shared memory cache and read the
code of mod_auth_digest.c for reference.  Take a code snippet of initializing
the shared memory.

    sts = apr_shm_create(&client_shm, shmem_size, tmpnam(NULL), ctx);
    if (sts != APR_SUCCESS) {
        log_error_and_cleanup("failed to create shared memory segments", sts, s);
        return;       
    }

    client_list = apr_rmm_malloc(client_rmm, sizeof(*client_list) +
                                            sizeof(client_entry*)*num_buckets);
    if (!client_list) {
        log_error_and_cleanup("failed to allocate shared memory", -1, s);
        return;
    }
    ....

The variable client_rmm is ever initialized up to calling apr_rmm_malloc() but
it seems running fine.  I suppose there is a missing of apr_rmm_init() before
to make shared memory block relocatable, and then follow by apr_rmm_addr_get()
to map the relocatable memory block.  Is it the dirty shortcut that skipped
these calls?

Regards,
-Fai

Mime
View raw message