]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Silence "Access to field 'type' 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:46:30 +0000 (14:46 +1100)
lib/isccfg/include/isccfg/cfg.h
lib/isccfg/parser.c

index 0d5e6ea2d8e53c5a5037b63acd49b8c53fcd9d2d..91ffc34bb5323906dd82490f0c49057a65f644f5 100644 (file)
@@ -395,6 +395,10 @@ cfg_obj_istype(const cfg_obj_t *obj, const cfg_type_t *type);
 void cfg_obj_destroy(cfg_parser_t *pctx, cfg_obj_t **obj);
 /*%<
  * Destroy a configuration object.
+ *
+ * Require:
+ * \li     '*obj' is a valid cfg_obj_t.
+ * \li     'pctx' is a valid cfg_parser_t.
  */
 
 void
index 3d02379447e0fa9b59214d8ab3067cf8d47fed81..d6e1643a50ba2a99b4b4df95c92fec3bcb86aaa6 100644 (file)
@@ -2390,7 +2390,12 @@ 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;
+
+       REQUIRE(objp != NULL && *objp != NULL);
+       REQUIRE(pctx != NULL);
+
+       obj = *objp;
        obj->type->rep->free(pctx, obj);
        isc_mem_put(pctx->mctx, obj, sizeof(cfg_obj_t));
        *objp = NULL;