Change some dynamic allocations back to static buffers to fix build.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 22 Oct 2008 14:49:56 +0000 (16:49 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 22 Oct 2008 14:49:56 +0000 (16:49 +0200)
source4/torture/masktest.c

index 5eccf86f11e2c8516367772f6cfc249a0ea6f113..ac29f5ba3a526bdd86fde91b674aca1659d8977a 100644 (file)
@@ -79,15 +79,12 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
                                        struct smbcli_session_options *session_options)
 {
        struct smbcli_state *c;
-       char *server;
+       char server[256];
        NTSTATUS status;
 
-       server = smb_xstrdup(share+2);
+       safe_strcpy(server,share+2,sizeof(server));
        share = strchr_m(server,'\\');
-       if (!share) {
-               SAFE_FREE(server);
-               return NULL;
-       }
+       if (!share) return NULL;
        *share = 0;
        share++;
 
@@ -100,8 +97,6 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
                                        cmdline_credentials, resolve_ctx, ev,
                                        options, session_options);
 
-       SAFE_FREE(server);
-
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
@@ -170,7 +165,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask,
                char *file)
 {
        int fnum;
-       char *res1;
+       char res1[256];
        char *res2;
        static int count;
        char *short_name = NULL;
@@ -179,7 +174,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask,
 
        count++;
 
-       res1 = talloc_strdup(mem_ctx, "---");
+       safe_strcpy(res1, "---", sizeof(res1));
 
        state.mem_ctx = mem_ctx;
 
@@ -191,8 +186,9 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask,
        smbcli_close(cli->tree, fnum);
 
        resultp = res1;
+       short_name = talloc_strdup(mem_ctx, "");
        get_real_name(mem_ctx, cli, &long_name, &short_name);
-       res1 = talloc_strdup(mem_ctx, "---");
+       safe_strcpy(res1, "---", sizeof(res1));
        smbcli_list_new(cli->tree, mask,
                        FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
                        RAW_SEARCH_DATA_BOTH_DIRECTORY_INFO,