>Number:         4827
>Category:       mod_auth-any
>Synopsis:       A small memory leak in mod_auth_db.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Aug  5 22:10:02 PDT 1999
>Last-Modified:
>Originator:     [EMAIL PROTECTED]
>Organization:
apache
>Release:        1.2.x, 1.3.x
>Environment:
All platforms that support mod_auth_db.
>Description:
mod_auth_db.c contains the following code. The memory 
pointed to by d.data is malloc()'ed in the berkeley db
routines and is never free()'ed.

#ifdef DB2
    if (!((f->get) (f, NULL, &q, &d, 0))) {
#else
    if (!((f->get) (f, &q, &d, 0))) {
#endif
        pw = ap_palloc(r->pool, d.size + 1);
        strncpy(pw, d.data, d.size);
        pw[d.size] = '\0';      /* Terminate the string */
    }

this can be fixed with

#ifdef DB2
    if (!((f->get) (f, NULL, &q, &d, 0))) {
#else
    if (!((f->get) (f, &q, &d, 0))) {
#endif
        pw = ap_palloc(r->pool, d.size + 1);
        strncpy(pw, d.data, d.size);
        pw[d.size] = '\0';      /* Terminate the string */
        free( d.data );         /* Plug the leak --pm */
    }

No this isn't a critical problem. But it is untidy. ;-) 
10000 hits per child with 150 children. It starts to add up.
>How-To-Repeat:

>Fix:

>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <[EMAIL PROTECTED]> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]



Reply via email to