The following reply was made to PR mod_auth-any/4827; it has been noted by GNATS.
From: "Ralf S. Engelschall" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: Subject: Re: mod_auth-any/4827: A small memory leak in mod_auth_db. Date: Sun, 28 Nov 1999 13:38:05 +0100 In article <[EMAIL PROTECTED]> you wrote: >>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. Hmm.... I've looked at DB 1.85 and DB 2.7.5 but I was still unable to see where it malloc()'s the data pointer. I don't want to add the free() to mod_auth_db.c before I was able to verify this behaviour in Berkeley-DB, of course. Also the man pages to not document this AFAIK. Can you give me more insights where it malloc()'s the stuff in Berkeley-DB and whether it is really _always_ malloc()'ed. I'd only a quick look at the DB code, but to me it looked that it at least doesn't _always_ malloc... Ralf S. Engelschall [EMAIL PROTECTED] www.engelschall.com