summaryrefslogtreecommitdiffstats
path: root/free_ldapsearchfilter.c
diff options
context:
space:
mode:
Diffstat (limited to 'free_ldapsearchfilter.c')
-rw-r--r--free_ldapsearchfilter.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/free_ldapsearchfilter.c b/free_ldapsearchfilter.c
new file mode 100644
index 0000000..d952f93
--- /dev/null
+++ b/free_ldapsearchfilter.c
@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include "ldap.h"
+
+void free_ldapsearchfilter(struct Filter* f) {
+ while (f) {
+ struct Filter* tmp=f->next;
+ switch (f->type) {
+ case AND: case OR: case NOT:
+ free_ldapsearchfilter(f->x);
+ break;
+ case SUBSTRING:
+ while (f->substrings) {
+ struct Substring* s=f->substrings->next;
+ free(f->substrings);
+ f->substrings=s;
+ }
+ default:
+ break;
+ }
+ free(f); f=tmp;
+ }
+}