mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-21 22:28:34 -04:00
Silence "Access to field 'refs' results in a dereference of a null pointer" by adding appropriate assertions.
This commit is contained in:
parent
d710475e18
commit
d8e8abdff9
2 changed files with 10 additions and 1 deletions
|
|
@ -411,6 +411,10 @@ cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **obj);
|
|||
/*%<
|
||||
* Delete a reference to a configuration object; destroy the object if
|
||||
* there are no more references.
|
||||
*
|
||||
* Require:
|
||||
* \li '*obj' is a valid cfg_obj_t.
|
||||
* \li 'pctx' is a valid cfg_parser_t.
|
||||
*/
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -2426,9 +2426,14 @@ cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type) {
|
|||
*/
|
||||
void
|
||||
cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **objp) {
|
||||
cfg_obj_t *obj = *objp;
|
||||
cfg_obj_t *obj;
|
||||
unsigned int refs;
|
||||
|
||||
REQUIRE(objp != NULL && *objp != NULL);
|
||||
REQUIRE(pctx != NULL);
|
||||
|
||||
obj = *objp;
|
||||
|
||||
isc_refcount_decrement(&obj->references, &refs);
|
||||
if (refs == 0) {
|
||||
obj->type->rep->free(pctx, obj);
|
||||
|
|
|
|||
Loading…
Reference in a new issue