summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/memcache.c14
-rw-r--r--source3/lib/util_pw.c2
2 files changed, 13 insertions, 3 deletions
diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c
index 1951b4abf9..eaff15deda 100644
--- a/source3/lib/memcache.c
+++ b/source3/lib/memcache.c
@@ -340,9 +340,19 @@ void memcache_add(struct memcache *cache, enum memcache_number n,
}
void memcache_add_talloc(struct memcache *cache, enum memcache_number n,
- DATA_BLOB key, void *ptr)
+ DATA_BLOB key, void **pptr)
{
- void *p = talloc_move(cache, &ptr);
+ void **ptr = (void **)pptr;
+ void *p;
+
+ if (cache == NULL) {
+ cache = global_cache;
+ }
+ if (cache == NULL) {
+ return;
+ }
+
+ p = talloc_move(cache, ptr);
memcache_add(cache, n, key, data_blob_const(&p, sizeof(p)));
}
diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c
index c9b26f0a4f..b0baa12c3e 100644
--- a/source3/lib/util_pw.c
+++ b/source3/lib/util_pw.c
@@ -63,7 +63,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
}
memcache_add_talloc(NULL, GETPWNAM_CACHE,
- data_blob_string_const_null(name), for_cache);
+ data_blob_string_const_null(name), &for_cache);
return tcopy_passwd(mem_ctx, pw);
}