summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 10:13:05 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 10:13:05 +0100
commitac13c9f09572227882e02a025373bf3147f49863 (patch)
treec5492ebe44e7dcafdbcf975a974e0e95e704f5ee
parenta66ec18e80bdd400ce331efb9ae537a2d9189614 (diff)
Only copy relevant fields from callback ptr to avoid copying garbage
-rw-r--r--async.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/async.c b/async.c
index ec452af..746cfce 100644
--- a/async.c
+++ b/async.c
@@ -75,8 +75,10 @@ static int __redisPushCallback(redisCallbackList *list, redisCallback *source) {
/* Copy callback from stack to heap */
cb = calloc(1,sizeof(*cb));
if (!cb) redisOOM();
- if (source != NULL)
- memcpy(cb,source,sizeof(*cb));
+ if (source != NULL) {
+ cb->fn = source->fn;
+ cb->privdata = source->privdata;
+ }
/* Store callback in list */
if (list->head == NULL)