3520. [bug] 'mctx' was not being referenced counted in some places
where it should have been. [RT #32794]
This commit is contained in:
@@ -387,13 +387,15 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) {
|
||||
if (pctx == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
pctx->mctx = NULL;
|
||||
isc_mem_attach(mctx, &pctx->mctx);
|
||||
|
||||
result = isc_refcount_init(&pctx->references, 1);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(mctx, pctx, sizeof(*pctx));
|
||||
isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
|
||||
return (result);
|
||||
}
|
||||
|
||||
pctx->mctx = mctx;
|
||||
pctx->lctx = lctx;
|
||||
pctx->lexer = NULL;
|
||||
pctx->seen_eof = ISC_FALSE;
|
||||
@@ -434,7 +436,7 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) {
|
||||
isc_lex_destroy(&pctx->lexer);
|
||||
CLEANUP_OBJ(pctx->open_files);
|
||||
CLEANUP_OBJ(pctx->closed_files);
|
||||
isc_mem_put(mctx, pctx, sizeof(*pctx));
|
||||
isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -555,7 +557,7 @@ cfg_parser_destroy(cfg_parser_t **pctxp) {
|
||||
*/
|
||||
CLEANUP_OBJ(pctx->open_files);
|
||||
CLEANUP_OBJ(pctx->closed_files);
|
||||
isc_mem_put(pctx->mctx, pctx, sizeof(*pctx));
|
||||
isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
|
||||
}
|
||||
*pctxp = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user