From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6qhA-0002Ks-IN for qemu-devel@nongnu.org; Tue, 06 Aug 2013 19:29:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6qh4-0002Q6-BG for qemu-devel@nongnu.org; Tue, 06 Aug 2013 19:29:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6qh4-0002PZ-3i for qemu-devel@nongnu.org; Tue, 06 Aug 2013 19:29:34 -0400 From: Amos Kong Date: Wed, 7 Aug 2013 07:29:26 +0800 Message-Id: <1375831766-3444-1-git-send-email-akong@redhat.com> Subject: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: vyasevic@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com, lersek@redhat.com We register exit clean function by atexit(), but alarm_timer is NULL here. If exit is caused between atexit() and alarm_timer assignment, real timer can't be cleaned. So move alarm_timer assignment before atexit(). Signed-off-by: Amos Kong --- qemu-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-timer.c b/qemu-timer.c index b2d95e2..9490105 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -767,11 +767,11 @@ int init_timer_alarm(void) goto fail; } + alarm_timer = t; atexit(quit_timers); #ifdef CONFIG_POSIX pthread_atfork(NULL, NULL, reinit_timers); #endif - alarm_timer = t; return 0; fail: -- 1.8.3.1