Blame SOURCES/dhcp-CVE-2022-2928.patch

9bd839
diff --git a/common/options.c b/common/options.c
9bd839
index ed8ac38..addc65a 100644
9bd839
--- a/common/options.c
9bd839
+++ b/common/options.c
9bd839
@@ -4397,6 +4397,8 @@ add_option(struct option_state *options,
9bd839
 	if (!option_cache_allocate(&oc, MDL)) {
9bd839
 		log_error("No memory for option cache adding %s (option %d).",
9bd839
 			  option->name, option_num);
9bd839
+		/* Get rid of reference created during hash lookup. */
9bd839
+		option_dereference(&option, MDL);
9bd839
 		return 0;
9bd839
 	}
9bd839
 
9bd839
@@ -4408,6 +4410,8 @@ add_option(struct option_state *options,
9bd839
 			     MDL)) {
9bd839
 		log_error("No memory for constant data adding %s (option %d).",
9bd839
 			  option->name, option_num);
9bd839
+		/* Get rid of reference created during hash lookup. */
9bd839
+		option_dereference(&option, MDL);
9bd839
 		option_cache_dereference(&oc, MDL);
9bd839
 		return 0;
9bd839
 	}
9bd839
@@ -4416,6 +4420,9 @@ add_option(struct option_state *options,
9bd839
 	save_option(&dhcp_universe, options, oc);
9bd839
 	option_cache_dereference(&oc, MDL);
9bd839
 
9bd839
+	/* Get rid of reference created during hash lookup. */
9bd839
+	option_dereference(&option, MDL);
9bd839
+
9bd839
 	return 1;
9bd839
 }
9bd839