mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-26 08:39:00 -04:00
1826. [bug] Missing DESTROYLOCK() in isc_mem_createx() on out
of memory error. [RT #13537]
This commit is contained in:
parent
231528cbdb
commit
83d6be3cc7
2 changed files with 20 additions and 16 deletions
7
CHANGES
7
CHANGES
|
|
@ -1,5 +1,8 @@
|
|||
1825. [bug] Missing unlock on out of memory error from in
|
||||
rbtdb.c:subtractrdataset(). [RT #13519]
|
||||
1826. [bug] Missing DESTROYLOCK() in isc_mem_createx() on out
|
||||
of memory error. [RT #13537]
|
||||
|
||||
1825. [bug] Missing UNLOCK() on out of memory error from in
|
||||
rbtdb.c:subtractrdataset(). [RT #13519]
|
||||
|
||||
1824. [bug] Memory leak on dns_zone_setdbtype() failure.
|
||||
[RT #13510]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: mem.c,v 1.98.2.7.2.5 2004/03/16 05:50:24 marka Exp $ */
|
||||
/* $Id: mem.c,v 1.98.2.7.2.6 2005/03/15 01:11:33 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
|
@ -717,6 +717,15 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||
if (ctx == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
if (isc_mutex_init(&ctx->lock) != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
(memfree)(arg, ctx);
|
||||
return (ISC_R_UNEXPECTED);
|
||||
}
|
||||
|
||||
if (init_max_size == 0U)
|
||||
ctx->max_size = DEF_MAX_SIZE;
|
||||
else
|
||||
|
|
@ -775,15 +784,6 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||
ctx->highest = NULL;
|
||||
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
|
||||
if (isc_mutex_init(&ctx->lock) != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"isc_mutex_init() %s",
|
||||
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
|
||||
ISC_MSG_FAILED, "failed"));
|
||||
result = ISC_R_UNEXPECTED;
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
if ((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0) {
|
||||
unsigned int i;
|
||||
|
|
@ -805,17 +805,18 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||
return (ISC_R_SUCCESS);
|
||||
|
||||
error:
|
||||
if (ctx) {
|
||||
if (ctx->stats)
|
||||
if (ctx != NULL) {
|
||||
if (ctx->stats != NULL)
|
||||
(memfree)(arg, ctx->stats);
|
||||
#if ISC_MEM_USE_INTERNAL_MALLOC
|
||||
if (ctx->freelists)
|
||||
if (ctx->freelists != NULL)
|
||||
(memfree)(arg, ctx->freelists);
|
||||
#endif /* ISC_MEM_USE_INTERNAL_MALLOC */
|
||||
#if ISC_MEM_TRACKLINES
|
||||
if (ctx->debuglist)
|
||||
if (ctx->debuglist != NULL)
|
||||
(ctx->memfree)(ctx->arg, ctx->debuglist);
|
||||
#endif /* ISC_MEM_TRACKLINES */
|
||||
DESTROYLOCK(&ctx->lock);
|
||||
(memfree)(arg, ctx);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue