apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49847] New: apr_pcalloc should assert that memory is allocated
Date Tue, 31 Aug 2010 05:39:21 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49847

           Summary: apr_pcalloc should assert that memory is allocated
           Product: APR
           Version: HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: db.pub.mail@gmail.com


Created an attachment (id=25962)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25962)
a potential patch.

Here is the existing code memory/unix/apr_pools.c from apr-1.4.2
APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size);
APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size)
{
    void *mem;

    if ((mem = apr_palloc(pool, size)) != NULL) {
        memset(mem, 0, size);
    }

    return mem;
}


I propose the that the method now asserts that this is the case, instead of
checking if :)

This way users of the method will be guaranteed memory or an assertion error
will be raised. (at least via the use of this particular method ;) ).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message