Memory leak in new rpc server infrastructure?
Jeremy Allison
jra at samba.org
Wed Oct 4 19:30:11 GMT 2006
On Wed, Oct 04, 2006 at 12:28:14PM -0700, Jeremy Allison wrote:
> On Wed, Oct 04, 2006 at 12:23:47PM -0700, Jeremy Allison wrote:
> > On Wed, Oct 04, 2006 at 09:22:23PM +0200, Volker Lendecke wrote:
> > > On Wed, Oct 04, 2006 at 09:14:21PM +0200, Jelmer Vernooij wrote:
> > > > I'll have a look at this on friday and see if I can get it fixed in
> > > > pidl. There shouldn't be a leak here though as it's allocated using
> > > > talloc.
> > >
> > > It's not the blob from the autogenerated code that leaks,
> > > it's the one from srv_pipe_hnd.c:662 that leaks, the
> > > autogenerated code unconditionally overwrites that.
> > >
> > > The problem is that the "old" code assumes this prior
> > > initialization.
> >
> > Yeah the "old" server code has already initialized this
> > prs_struct with malloc'ed memory. The call to :
> >
> > prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx_
> >
> > needs to be changed to :
> >
> > prs_copy_data_in(&p->out_data.rdata, blob.data, blob.length);
> >
> > in the auto-generated code.
>
> Jelmer,
>
> How about this patch :
Actually, should be this (need to cast size_t) to (uint32).
Jeremy.
-------------- next part --------------
Index: lib/Parse/Pidl/Samba3/ServerNDR.pm
===================================================================
--- lib/Parse/Pidl/Samba3/ServerNDR.pm (revision 19059)
+++ lib/Parse/Pidl/Samba3/ServerNDR.pm (working copy)
@@ -138,7 +138,7 @@
pidl "}";
pidl "";
pidl "blob = ndr_push_blob(push);";
- pidl "if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {";
+ pidl "if (!prs_copy_data_in(&p->out_data.rdata, blob.data, (uint32)blob.length)) {";
pidl "\ttalloc_free(mem_ctx);";
pidl "\treturn False;";
pidl "}";
More information about the samba-technical
mailing list