How to use ndr_pull_struct_blob?

Michael Wood esiotrot at gmail.com
Sat Jan 1 18:51:01 MST 2011


Hi

On 2 January 2011 03:14,  <tridge at samba.org> wrote:
[...]
> This means that a ndr function is allocating memory for a structure
> element on ndr instead of on ndr->current_mem_ctx. From your
> backtrace, the culprit seems to be ndr_pull_nbt_string(), which
> allocates on ndr via both talloc_strdup() and ndr_pull_component().
>
> It seems to be a pretty common mistake in our hand-written
> ndr_pull_*() functions.
>
> If you fix the ones in nbtname.c to use ndr->current_mem_ctx then the
> above error should go away, but that still leaves us with the problem
> of finding all the other places where this mistake has been made.

Perhaps Coccinelle might help to find (and maybe fix) them?

http://coccinelle.lip6.fr/

I don't know enough about the problem or about Coccinelle to say for
sure, but it is a way to automate looking for problems in C code.  It
can also be used to generate patches to fix the problems.

e.g. it is used on the Linux kernel:

http://coccinelle.lip6.fr/impact_linux.php

-- 
Michael Wood <esiotrot at gmail.com>


More information about the samba-technical mailing list