r15811: Fix mget command without arguments. Caught by the IBM Checker.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 22 May 2006 16:40:54 +0000 (16:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:26 +0000 (14:08 -0500)
(This used to be commit c77fd9f515bee07e50cb6acfe02f9f5836f1a67a)

source4/client/client.c

index 4672e468acf70cee16627c374ec23ccb57a3f5ff..20542c0183723e1f46bd1561cd53a84794aa6e79 100644 (file)
@@ -935,7 +935,7 @@ do a mget command
 static int cmd_mget(struct smbclient_context *ctx, const char **args)
 {
        uint16_t attribute = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
-       char *mget_mask;
+       char *mget_mask = NULL;
        int i;
 
        if (ctx->recurse)
@@ -950,14 +950,15 @@ static int cmd_mget(struct smbclient_context *ctx, const char **args)
                if (mget_mask[0] != '\\')
                        mget_mask = talloc_append_string(ctx, mget_mask, "\\");
                do_list(ctx, mget_mask, attribute,do_mget,False,True);
+
+               talloc_free(mget_mask);
        }
 
-       if (!*mget_mask) {
+       if (mget_mask == NULL) {
                mget_mask = talloc_asprintf(ctx, "%s\\*", ctx->remote_cur_dir);
                do_list(ctx, mget_mask, attribute,do_mget,False,True);
+               talloc_free(mget_mask);
        }
-
-       talloc_free(mget_mask);
        
        return 0;
 }