summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-09-04 08:22:43 +0200
committerJeremy Allison <jra@samba.org>2013-09-05 09:16:22 -0700
commit1173fed9165dffb79cfb119b6e80e379a6fd85ba (patch)
tree307be2938428f3fc6c8ad236d343a04f452ecfea /source3/lib
parent46131cb8023a883238b67e668be2afbc4adcf1f5 (diff)
downloadsamba-1173fed9165dffb79cfb119b6e80e379a6fd85ba.tar.gz
samba-1173fed9165dffb79cfb119b6e80e379a6fd85ba.tar.bz2
samba-1173fed9165dffb79cfb119b6e80e379a6fd85ba.zip
lib: Add "mem_ctx" to gencache_get_data_blob
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/gencache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 08adf2173a..7d89c7d05a 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -368,7 +368,8 @@ bool gencache_del(const char *keystr)
* element.
*/
- exists = gencache_get_data_blob(keystr, &value, NULL, &was_expired);
+ exists = gencache_get_data_blob(keystr, NULL, &value, NULL,
+ &was_expired);
if (!exists && was_expired) {
/*
@@ -469,6 +470,7 @@ bool gencache_parse(const char *keystr,
}
struct gencache_get_data_blob_state {
+ TALLOC_CTX *mem_ctx;
DATA_BLOB *blob;
time_t timeout;
bool result;
@@ -491,7 +493,8 @@ static void gencache_get_data_blob_parser(time_t timeout, DATA_BLOB blob,
return;
}
- *state->blob = data_blob(blob.data, blob.length);
+ *state->blob = data_blob_talloc(state->mem_ctx, blob.data,
+ blob.length);
if (state->blob->data == NULL) {
state->result = false;
return;
@@ -511,13 +514,15 @@ static void gencache_get_data_blob_parser(time_t timeout, DATA_BLOB blob,
* @retval False for failure
**/
-bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
+bool gencache_get_data_blob(const char *keystr, TALLOC_CTX *mem_ctx,
+ DATA_BLOB *blob,
time_t *timeout, bool *was_expired)
{
struct gencache_get_data_blob_state state;
bool expired = false;
state.result = false;
+ state.mem_ctx = mem_ctx;
state.blob = blob;
if (!gencache_parse(keystr, gencache_get_data_blob_parser, &state)) {
@@ -705,7 +710,7 @@ bool gencache_get(const char *keystr, char **value, time_t *ptimeout)
DATA_BLOB blob;
bool ret = False;
- ret = gencache_get_data_blob(keystr, &blob, ptimeout, NULL);
+ ret = gencache_get_data_blob(keystr, NULL, &blob, ptimeout, NULL);
if (!ret) {
return false;
}