timer: Fix use after free issue
Change-Id: I056c9777b242a11af7f576ad19b2db93dbdf82d4 BUG: 1215117 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/10367 Reviewed-by: Poornima G <pgurusid@redhat.com> Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
b72bc58ecc
commit
48de998d58
@ -176,12 +176,16 @@ gf_timer_proc (void *ctx)
|
||||
}
|
||||
pthread_mutex_unlock (®->lock);
|
||||
if (need_cbk) {
|
||||
old_THIS = NULL;
|
||||
if (event->xl) {
|
||||
old_THIS = THIS;
|
||||
THIS = event->xl;
|
||||
}
|
||||
event->callbk (event->data);
|
||||
if (event->xl) {
|
||||
/*This callbk above would have freed the event
|
||||
* by calling timer_cancel, don't ever touch it
|
||||
* again*/
|
||||
if (old_THIS) {
|
||||
THIS = old_THIS;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user