r2661: fixed a client side memory leak in the clilist code.
authorAndrew Tridgell <tridge@samba.org>
Sun, 26 Sep 2004 11:45:14 +0000 (11:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:18 +0000 (12:59 -0500)
commitbd813dfb1b08b586dc71f9cec4eb65b35ea808fe
treeb3bf4eb76929bb626173fdb1feb568d87bce15e4
parentc315d6ac1cc40546fde1474702a6d66d07ee13c8
r2661: fixed a client side memory leak in the clilist code.

This sort of bug happens quite easily with the new talloc_realloc()
interface. talloc_realloc() now looks like this:

  void *talloc_realloc(void *ptr, size_t size);

and if ptr is not NULL then everything is fine. If ptr is NULL then
talloc_realloc() presumes you want to allocate in the NULL context,
which is probably not what is wanted.

For now the solution is to initialise ptr like this:
  ptr = talloc(mem_ctx, 0);
so when the realloc happens it has a context to get hold of.

I might change the interface of talloc_realloc() later to prevent this
problem in a more robust manner
source/libcli/clilist.c