| From 3fc5a79750c443087ac0968085fadba74cce555d Mon Sep 17 00:00:00 2001 |
| From: Puran Chand <pchand@vmware.com> |
| Date: Fri, 6 Apr 2018 14:17:35 -0700 |
| Subject: [PATCH] s3: libsmbclient: Add readdirplus cleanup code on directory |
| close. |
| |
| Signed-off-by: Puran Chand <pchand@vmware.com> |
| Reviewed-by: Jeremy Allison <jra@samba.org> |
| Reviewed-by: Andreas Schneider <asn@samba.org> |
| Reviewed-by: Alexander Bokovoy <ab@samba.org> |
| --- |
| source3/libsmb/libsmb_dir.c | 21 +++++++++++++++++++++ |
| 1 file changed, 21 insertions(+) |
| |
| diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c |
| index 8c3fed672f8..828a28fe87d 100644 |
| --- a/source3/libsmb/libsmb_dir.c |
| +++ b/source3/libsmb/libsmb_dir.c |
| @@ -40,6 +40,26 @@ |
| * We accept the URL syntax explained in SMBC_parse_path(), above. |
| */ |
| |
| +static void remove_dirplus(SMBCFILE *dir) |
| +{ |
| + struct smbc_dirplus_list *d = NULL; |
| + |
| + d = dir->dirplus_list; |
| + while (d != NULL) { |
| + struct smbc_dirplus_list *f = d; |
| + d = d->next; |
| + |
| + SAFE_FREE(f->smb_finfo->short_name); |
| + SAFE_FREE(f->smb_finfo->name); |
| + SAFE_FREE(f->smb_finfo); |
| + SAFE_FREE(f); |
| + } |
| + |
| + dir->dirplus_list = NULL; |
| + dir->dirplus_end = NULL; |
| + dir->dirplus_next = NULL; |
| +} |
| + |
| static void |
| remove_dir(SMBCFILE *dir) |
| { |
| @@ -930,6 +950,7 @@ SMBC_closedir_ctx(SMBCCTX *context, |
| } |
| |
| remove_dir(dir); /* Clean it up */ |
| + remove_dirplus(dir); |
| |
| DLIST_REMOVE(context->internal->files, dir); |
| |