r4957: the fetchfile _recv() function was neglecting to steal the data and
authorAndrew Tridgell <tridge@samba.org>
Mon, 24 Jan 2005 03:43:48 +0000 (03:43 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:10 +0000 (13:09 -0500)
free the connection context. This left a whole lot of state hanging
around and didn't give the memory to the caller properly
(This used to be commit 3e13e1d526563d91cb2342ae68455e54eb49a9bd)

source4/libcli/composite/fetchfile.c

index 24f4808f64f41a83a40df437a92031ba1ca5a3ee..8178090398d204c555afc5c14d37eabda0ed37f6 100644 (file)
@@ -168,7 +168,17 @@ struct smbcli_composite *smb_composite_fetchfile_send(struct smb_composite_fetch
 NTSTATUS smb_composite_fetchfile_recv(struct smbcli_composite *c,
                                      TALLOC_CTX *mem_ctx)
 {
-       return smb_composite_wait(c);
+       NTSTATUS status;
+
+       status = smb_composite_wait(c);
+
+       if (NT_STATUS_IS_OK(status)) {
+               struct fetchfile_state *state = talloc_get_type(c->private, struct fetchfile_state);
+               talloc_steal(mem_ctx, state->io->out.data);
+       }
+
+       talloc_free(c);
+       return status;
 }
 
 NTSTATUS smb_composite_fetchfile(struct smb_composite_fetchfile *io,