mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Fixed some memory management problems in sortlist code [rt17216]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: parser.c,v 1.126 2007/09/14 01:46:05 marka Exp $ */
|
||||
/* $Id: parser.c,v 1.127 2007/10/12 04:17:18 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1114,16 +1114,20 @@ cfg_list_next(const cfg_listelt_t *elt) {
|
||||
* a list, return 0.
|
||||
*/
|
||||
unsigned int
|
||||
cfg_list_length(const cfg_obj_t *obj) {
|
||||
cfg_list_length(const cfg_obj_t *obj, isc_boolean_t recurse) {
|
||||
const cfg_listelt_t *elt;
|
||||
unsigned int count = 0;
|
||||
|
||||
if (obj == NULL || ! cfg_obj_islist(obj))
|
||||
if (obj == NULL || !cfg_obj_islist(obj))
|
||||
return (0U);
|
||||
for (elt = cfg_list_first(obj);
|
||||
elt != NULL;
|
||||
elt = cfg_list_next(elt)) {
|
||||
count++;
|
||||
if (recurse && cfg_obj_islist(elt->obj)) {
|
||||
count += cfg_list_length(elt->obj, recurse);
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return (count);
|
||||
}
|
||||
|
Reference in New Issue
Block a user