summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-11-06 20:48:13 -0800
committerJeremy Allison <jra@samba.org>2008-11-06 20:48:13 -0800
commit8962be69c700224983af4effd2cd086f7f5800b0 (patch)
treead2149c31ca5102a213a13a75cd511b11c64d812 /source3/passdb
parent7ae625345536572aa946f0715542a5cf2dbc2169 (diff)
downloadsamba-8962be69c700224983af4effd2cd086f7f5800b0.tar.gz
samba-8962be69c700224983af4effd2cd086f7f5800b0.tar.bz2
samba-8962be69c700224983af4effd2cd086f7f5800b0.zip
Make us clean under valgrind --leak-check=full by using talloc_autofree_context() instead of NULL.
Remove the code in memcache that does a TALLOC_FREE on stored pointers. That's a disaster waiting to happen. If you're storing talloc'ed pointers, you can't know their lifecycle and they should be deleted when their parent context is deleted, so freeing them at some arbitrary point later will be a double-free. Jeremy.
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c2
-rw-r--r--source3/passdb/pdb_interface.c4
-rw-r--r--source3/passdb/util_unixsids.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 60699615f0..8367d6a9ad 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -665,7 +665,7 @@ NTSTATUS local_password_change(const char *user_name,
DEBUGLEVEL = 1;
}
- if ( !(pwd = getpwnam_alloc( NULL, user_name)) ) {
+ if ( !(pwd = getpwnam_alloc(talloc_autofree_context(), user_name)) ) {
return NT_STATUS_NO_SUCH_USER;
}
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index fcb38b464b..6fe105854f 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -242,7 +242,7 @@ bool guest_user_info( struct samu *user )
NTSTATUS result;
const char *guestname = lp_guestaccount();
- if ( !(pwd = getpwnam_alloc( NULL, guestname ) ) ) {
+ if ( !(pwd = getpwnam_alloc(talloc_autofree_context(), guestname ) ) ) {
DEBUG(0,("guest_user_info: Unable to locate guest account [%s]!\n",
guestname));
return False;
@@ -2016,7 +2016,7 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
{
/* allocate memory for the structure as its own talloc CTX */
- if ( !(*methods = TALLOC_ZERO_P(NULL, struct pdb_methods) ) ) {
+ if ( !(*methods = TALLOC_ZERO_P(talloc_autofree_context(), struct pdb_methods) ) ) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/passdb/util_unixsids.c b/source3/passdb/util_unixsids.c
index 1b674d02a2..ad4e70256d 100644
--- a/source3/passdb/util_unixsids.c
+++ b/source3/passdb/util_unixsids.c
@@ -56,7 +56,7 @@ bool lookup_unix_user_name(const char *name, DOM_SID *sid)
{
struct passwd *pwd;
- pwd = getpwnam_alloc(NULL, name);
+ pwd = getpwnam_alloc(talloc_autofree_context(), name);
if (pwd == NULL) {
return False;
}