diff options
author | Volker Lendecke <vl@samba.org> | 2008-11-14 13:42:54 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-11-14 20:27:46 +0100 |
commit | 3c98d5bd987358b1cbeb81fa8db37b97492cf0cc (patch) | |
tree | 0058070438a145865d8b2cf80697bd3d2a1d999a /source3/lib/memcache.c | |
parent | f50ad767505cc8847f5f574767b664b57326e468 (diff) | |
download | samba-3c98d5bd987358b1cbeb81fa8db37b97492cf0cc.tar.gz samba-3c98d5bd987358b1cbeb81fa8db37b97492cf0cc.tar.bz2 samba-3c98d5bd987358b1cbeb81fa8db37b97492cf0cc.zip |
Make memcache_add_talloc NULL out the source pointer
This is an orthogonality measure to make clear this pointer now belongs to the
cache.
(cherry picked from commit e6080c6e87d6fe3995b121a772bf3f6343fa666f)
Diffstat (limited to 'source3/lib/memcache.c')
-rw-r--r-- | source3/lib/memcache.c | 14 |
1 files changed, 12 insertions, 2 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))); } |