diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-01 10:13:05 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-01 10:13:05 +0100 |
commit | ac13c9f09572227882e02a025373bf3147f49863 (patch) | |
tree | c5492ebe44e7dcafdbcf975a974e0e95e704f5ee | |
parent | a66ec18e80bdd400ce331efb9ae537a2d9189614 (diff) |
Only copy relevant fields from callback ptr to avoid copying garbage
-rw-r--r-- | async.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |