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