apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: svn commit: r683191 - /apr/apr-util/trunk/misc/apr_reslist.c
Date Wed, 06 Aug 2008 21:29:57 GMT
On Wed, 2008-08-06 at 12:46 +0200, Ruediger Pluem wrote:

> I am worried about the case that the destructor might allocate
> memory from the pool for temporary purposes (ok that would be a
> memory leak in the long run).

Not only that, but if you have a look at testreslist.c, you'll find
this:
----------------------------
static apr_status_t my_destructor(void *resource, void *params,
                                  apr_pool_t *pool)
{
    my_resource_t *res = resource;
    my_parameters_t *my_params = params;
    res->id = my_params->d_count++;

    apr_sleep(my_params->sleep_upon_destruct);

    return APR_SUCCESS;
}
----------------------------

The line "res->id = my_params->d_count++;" is updating a common
structure. Previously, this would be done under a lock in all
circumstances. With the change, this would no longer be the case. This
has potential to cause havoc in existing code. No?

-- 
Bojan


Mime
View raw message