Only copy relevant fields from callback ptr to avoid copying garbage

This commit is contained in:
Pieter Noordhuis 2010-11-01 10:13:05 +01:00
parent a66ec18e80
commit ac13c9f095
1 changed files with 4 additions and 2 deletions

View File

@ -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)