Commit ac13c9f0 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Only copy relevant fields from callback ptr to avoid copying garbage

parent a66ec18e
...@@ -75,8 +75,10 @@ static int __redisPushCallback(redisCallbackList *list, redisCallback *source) { ...@@ -75,8 +75,10 @@ static int __redisPushCallback(redisCallbackList *list, redisCallback *source) {
/* Copy callback from stack to heap */ /* Copy callback from stack to heap */
cb = calloc(1,sizeof(*cb)); cb = calloc(1,sizeof(*cb));
if (!cb) redisOOM(); if (!cb) redisOOM();
if (source != NULL) if (source != NULL) {
memcpy(cb,source,sizeof(*cb)); cb->fn = source->fn;
cb->privdata = source->privdata;
}
/* Store callback in list */ /* Store callback in list */
if (list->head == NULL) if (list->head == NULL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment