1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

42 Commits

Author SHA1 Message Date
Jeremy Allison
aa8439a49e Finish adding strings to all talloc_init() calls.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
09a218a9f6 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
bcd22a9039 The name pointer in the talloc context must not be a talloced entry as
calling talloc_destroy_pool(as we do sometimes) will destroy it.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
03ac082dcb updated the 3.0 branch from the head branch - ready for alpha18 0001-01-01 00:00:00 +00:00
Simo Sorce
9836af7cd6 more verbose checking in talloc and util_pw
fixed tdbsam memory corruption (and segfault)
reducing calls to pdb_uid_to_user_rid and countrary to 0 to move to a non alghoritmic rid allocation with some passdb modules.
0001-01-01 00:00:00 +00:00
Tim Potter
a3cea5e9ae getpid() -> sys_getpid() 0001-01-01 00:00:00 +00:00
Martin Pool
58c1b11439 Fix typo. 0001-01-01 00:00:00 +00:00
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
873dba59cf picky about realloc
J.F.
0001-01-01 00:00:00 +00:00
Martin Pool
682e7cd394 FIXME We should turn the global list off when using Insure++,
otherwise all the memory will be seen as still reachable.
0001-01-01 00:00:00 +00:00
Martin Pool
86abefc172 Cope nicely with pools with no name. 0001-01-01 00:00:00 +00:00
Martin Pool
cd25d01e42 talloc accounting now includes number of chunks and bytes allocated. 0001-01-01 00:00:00 +00:00
Martin Pool
53723e8748 Add talloc_asprintf_append, which grows an existing string buffer to
contain new print-formatted information.  (Also
talloc_vasprintf_append.)  Idea borrowed from glib.
0001-01-01 00:00:00 +00:00
Martin Pool
e76d27fcdb Add --enable-dmalloc to link against the dmalloc malloc debugger.
It's not as strong as Insure, but it's free, reasonably efficient and
works on every platform.
0001-01-01 00:00:00 +00:00
Martin Pool
4c6c03c8c7 Make TALLOC_CTX and talloc_chunk private to talloc.c.
Add a global singly-linked list of all active talloc pools, so that we
can eventually show how much memory is used for different purposes.
This also gives a check that pools are not being doubly freed.

talloc_init_named now handle a NULL name properly (ie does nothing)

Add accessor talloc_pool_name().
0001-01-01 00:00:00 +00:00
Martin Pool
7da982e926 Doc 0001-01-01 00:00:00 +00:00
Martin Pool
5dc2827b6e Doc 0001-01-01 00:00:00 +00:00
Martin Pool
e6be48671d Put PRINTF_ATTRIBUTE on talloc_init_named, talloc_asprintf,
talloc_vasprintf.
0001-01-01 00:00:00 +00:00
Martin Pool
5b6c22a209 Doc. 0001-01-01 00:00:00 +00:00
Martin Pool
25b97a7435 Start adding some debugging features to talloc based on Samba's
ancient mem_man.c:

Each TALLOC_CTX now has a field to store its purpose, to aid in
tracking down memory bloat.  A new call talloc_init_named() should be
used instead of talloc_init() so that this is set.

Added talloc_vasprintf to be called by varargs functions.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
2b2155beae fixed an off by 1 bug in talloc_asprintf() 0001-01-01 00:00:00 +00:00
Andrew Tridgell
ea5d285721 const religion in talloc calls 0001-01-01 00:00:00 +00:00
Andrew Tridgell
acd84ed762 return of vsnprintf doesn't include termination
thanks to simo for spotting this
0001-01-01 00:00:00 +00:00
Andrew Tridgell
8ca8875cd9 bit neater talloc_asprintf() implementation 0001-01-01 00:00:00 +00:00
Simo Sorce
7264d611ef introduce mangle backward compatibility functions
add talloc_asprintf()
0001-01-01 00:00:00 +00:00
Simo Sorce
60e907b7e8 move to SAFE_FREE() 0001-01-01 00:00:00 +00:00
Simo Sorce
7f33c01688 Change all realloc() statements to Realloc() (ecxept for tdb.c)
changed some code to exploit the fact that Realloc(NULL, size) == malloc(size)
fixed some possible mem leaks, or seg faults.

thanks to andreas moroder (mallocs not checked in client/client.c, client/smbumount.c)
0001-01-01 00:00:00 +00:00
Jeremy Allison
1ab31e5db5 Made talloc_realloc() semantics match realloc(). JF was complaining :-).
realloc(NULL) == malloc. realloc(p,0) == free() - a no-op in talloc.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
5f4889beb9 Spelling fix. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
7a96ca313e the BAD_PTR idea in talloc.h is actually a bad idea - it means callers have no way of telling if the call really failed 0001-01-01 00:00:00 +00:00
Tim Potter
eea43a5a91 Added talloc_strdup() funcion. 0001-01-01 00:00:00 +00:00
Jeremy Allison
be825b0746 Added Gerald's fixes.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
1ab63cf3a6 a much simpler talloc() implementation. This version has the following
advantages:

- memory is trackable by insure
- a very simple talloc_realloc() is possible (I've added it)

It is slower than the previous talloc code, but I don't think that
is going to be a problem. If it is a problem then there are
some ways we can make it faster but I'd like to leave those
until we have tested this a bit and can see what performance
problems might show up in profiling
0001-01-01 00:00:00 +00:00
Jeremy Allison
14d5997dc8 Move to talloc control of SPOOL_XXX structs. Move to talloc control of
security descriptors and pointers. Syncup with 2.2 tree.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
d3a56c6042 Added total memory allocated counter to talloc, so we can tell if a talloc
pool is getting bloated. Also added a talloc_zero function to return zeroed memory.
Added debug in rpc_server/srv_pipe_hnd.c so we know when a talloc pool is being
freed. Syncup with srv_pipe_hnd.c from 2.2 so we are freeing memory at the same time.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
0a40bc83e1 Fixed memory leaks in lsa_XX calls. Fixed memory leaks in smbcacls. Merged
in fixes from appliance-head and 2.2. Fixed multiple connection.tdb open
problem.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
233b9cffa2 reworked talloc() to in order to help track down invalid
memory access.

Tridge, I don't think using 0xdeadbeef for size allocations
of 0 is going to work.  I ended up having to use NULL
as much code that works on UNISTR checks to see if the buffer ptr
is NULL.  So valid code ends up with a seg fault.

Rather than rewriting it all, I added a DEBUG_TALLOC
#ifdef in talloc.h that sets a macro BAD_PTR.
This is the value assigned to ptr for an allocation of 0 bytes.



jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
df51dc32f6 talloc returns 0xdeadbeef when asked to allocate 0 bytes
jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
0ff2ce543e Ok - this is a *BIG* change - but it fixes the problems with static strings
in the RPC code. This change was prompted by trying to save a long (>256)
character comment in the printer properties page.

The new system associates a TALLOC_CTX with the pipe struct, and frees
the pool on return of a complete PDU.

A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx
code, and is freed in the main loop.

This code works with insure, and seems to be free of memory leaks and
crashes (so far) but there are probably the occasional problem with
code that uses UNISTRxx structs on the stack and expects them to contain
storage without doing a init_unistrXX().

This means that rpcclient will probably be horribly broken.
A TALLOC_CTX also needed associating with the struct cli_state also,
to make the prs_xx code there work.

The main interface change is the addition of a TALLOC_CTX to the
prs_init calls - used for dynamic allocation in the prs_XXX calls.

Now this is in place it should make dynamic allocation of all RPC
memory on unmarshall *much* easier to fix.

Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
064cdb7ee6 fixed size alignment in talloc 0001-01-01 00:00:00 +00:00
Jeremy Allison
20d72e8959 Fixed pointer arithmetic found by IRIX compiler.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
aa7f815525 implemented talloc() as described on samba-technical. This fixes the
lp_string() bug properly.

we still need to add lp_talloc_free() calls in all the main event
loops, I've only put it in smbd and nmbd thus far.
0001-01-01 00:00:00 +00:00