smbclient: Simplify do_list()
authorVolker Lendecke <vl@samba.org>
Fri, 5 Jun 2020 13:09:44 +0000 (15:09 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 10 Jun 2020 23:43:04 +0000 (23:43 +0000)
With the DLIST-based work queue we don't need to protect the "list
head" from reallocation anymore

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 10 23:43:04 UTC 2020 on sn-devel-184

source3/client/client.c

index 509544ab27a85cd6d188c98ef04639116aa442a9..d233becba22412e1374eef774e5b17db0530b4bf 100644 (file)
@@ -832,18 +832,7 @@ NTSTATUS do_list(const char *mask,
        add_to_do_list_queue(mask);
 
        while (!do_list_queue_empty()) {
-               /*
-                * Need to copy head so that it doesn't become
-                * invalid inside the call to cli_list.  This
-                * would happen if the list were expanded
-                * during the call.
-                * Fix from E. Jay Berkenbilt (ejb@ql.org)
-                */
-               char *head = talloc_strdup(ctx, do_list_queue_head());
-
-               if (!head) {
-                       return NT_STATUS_NO_MEMORY;
-               }
+               const char *head = do_list_queue_head();
 
                /* check for dfs */
 
@@ -885,7 +874,6 @@ NTSTATUS do_list(const char *mask,
                                *save_ch = CLI_DIRSEP_CHAR;
                        }
                }
-               TALLOC_FREE(head);
                TALLOC_FREE(targetpath);
        }