https://bz.apache.org/bugzilla/show_bug.cgi?id=70294

            Bug ID: 70294
           Summary: mod_socache_dbm: socache_dbm_iterate skips
                    apr_dbm_close() when the iterator callback fails,
                    leaking an open DBM handle
           Product: Apache httpd-2
           Version: 2.4.69
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: mod_socache_(dbm|dc|memcache|shmcb)
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Description
-----------
In modules/cache/mod_socache_dbm.c, socache_dbm_iterate() closes the database
only once, after the loop:

    rv = apr_dbm_firstkey(dbm, &dbmkey);
    while (rv == APR_SUCCESS && dbmkey.dptr != NULL) {
        ...
        if (!expired) {
            rv = iterator(ctx, s, userctx, ...);
            if (rv != APR_SUCCESS)
                return rv;        /* <-- dbm never closed */
        }
        rv = apr_dbm_nextkey(dbm, &dbmkey);
    }
    apr_dbm_close(dbm);

That early return is the only one after a successful open, so it is the only
path leaking the handle. Every other early return in this file closes it
(store on apr_dbm_store failure; retrieve on fetch failure, invalid datum,
destlen too small), so the omission looks accidental.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to