summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--async.c5
-rw-r--r--async.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/async.c b/async.c
index a966ed5..6990e86 100644
--- a/async.c
+++ b/async.c
@@ -109,6 +109,7 @@ static redisAsyncContext *redisAsyncInitialize(redisContext *c) {
ac->err = 0;
ac->errstr = NULL;
ac->data = NULL;
+ ac->dataCleanup = NULL;
ac->ev.data = NULL;
ac->ev.addRead = NULL;
@@ -299,6 +300,10 @@ static void __redisAsyncFree(redisAsyncContext *ac) {
}
}
+ if (ac->dataCleanup) {
+ ac->dataCleanup(ac->data);
+ }
+
/* Cleanup self */
redisFree(c);
}
diff --git a/async.h b/async.h
index 4f6b3b7..781f1d1 100644
--- a/async.h
+++ b/async.h
@@ -70,6 +70,7 @@ typedef struct redisAsyncContext {
/* Not used by hiredis */
void *data;
+ void (*dataCleanup)(void *privdata);
/* Event library data and hooks */
struct {