Memory leak in ldns_edns_option_list_clone
@@ -202,13 +202,13 @@ ldns_edns_option_list_clone(ldns_edns_option_list *old_list)
/* adding options also updates the total options size */
for (i = 0; i < old_list->_option_count; i++) {
- if (!(ldns_edns_option_list_push(new_list,
- ldns_edns_clone(ldns_edns_option_list_get_option(old_list, i))))){
+ ldns_edns_option *option = ldns_edns_clone(ldns_edns_option_list_get_option(old_list, i));
+ if (!ldns_edns_option_list_push(new_list, option)) {
+ ldns_edns_deep_free(option);
ldns_edns_option_list_deep_free(new_list);
return NULL;
}
}
-
return new_list;
}
