]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Silence "Access to field 'refs' results in a dereference of a null pointer" by adding...
authorMark Andrews <marka@isc.org>
Thu, 17 Jan 2013 03:38:28 +0000 (14:38 +1100)
committerMark Andrews <marka@isc.org>
Thu, 17 Jan 2013 03:39:47 +0000 (14:39 +1100)
lib/isccfg/include/isccfg/cfg.h
lib/isccfg/parser.c

index f46776834465e076d98e36377e7f8a3df6aa054d..9997c0697fbeb807748ad81f95be4a662571e1c7 100644 (file)
@@ -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
index ef20184f397550c384de771e0f402e5002ee4a36..b56b0d59b61c2dec0297e7c0cb6bcc54f6ea56de 100644 (file)
@@ -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);