From: Joseph Sutton Date: Fri, 6 Oct 2023 01:33:16 +0000 (+1300) Subject: s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738) X-Git-Tag: tevent-0.16.0~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea561fea6fbaa0876cd1f43f2197afc809e76c20;p=thirdparty%2Fsamba.git s4:dsdb: Replace early ‘continue’ with ‘if’ statement (CID 1414738) A ‘continue’ statement creates the misleading impression that this loop executes more than once. This also avoids ‘mem_ctx’ being leaked. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/schema/schema_convert_to_ol.c b/source4/dsdb/schema/schema_convert_to_ol.c index 259d9b9f976..013787e9f4c 100644 --- a/source4/dsdb/schema/schema_convert_to_ol.c +++ b/source4/dsdb/schema/schema_convert_to_ol.c @@ -49,7 +49,8 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema * return NULL; } - do { + /* We have been asked to skip some attributes/objectClasses */ + if (attrs_skip == NULL || !str_list_check_ci(attrs_skip, objectclass->lDAPDisplayName)) { TALLOC_CTX *mem_ctx = talloc_new(append_to_string); const char *name = objectclass->lDAPDisplayName; const char *oid = objectclass->governsID_oid; @@ -72,11 +73,6 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema * return NULL; } - /* We have been asked to skip some attributes/objectClasses */ - if (attrs_skip && str_list_check_ci(attrs_skip, name)) { - continue; - } - /* We might have been asked to remap this oid, due to a conflict */ for (j=0; oid_map && oid_map[j].old_oid; j++) { if (strcasecmp(oid, oid_map[j].old_oid) == 0) { @@ -154,7 +150,7 @@ static char *print_schema_recursive(char *append_to_string, struct dsdb_schema * return NULL; } talloc_free(mem_ctx); - } while (0); + } for (objectclass=schema->classes; objectclass; objectclass = objectclass->next) {