/*%<
* 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
*/
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);