diff options
| author | Kirill Batuzov <batuzovk@ispras.ru> | 2014-05-06 16:59:53 +0400 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-05-09 20:57:32 +0200 |
| commit | 02ce232c5051854bf49e6d2816c65e00f6d7e036 (patch) | |
| tree | b250aca2293310da6fbf6a396a6f34dd67f9df84 | |
| parent | b1e6fc0817dca14a3581d7b0979a5885608981f2 (diff) | |
| download | focaccia-qemu-02ce232c5051854bf49e6d2816c65e00f6d7e036.tar.gz focaccia-qemu-02ce232c5051854bf49e6d2816c65e00f6d7e036.zip | |
vl.c: remove init_clocks call from main
Clocks are initialized in qemu_init_main_loop. They are not needed before it. Initializing them twice is not only unnecessary but is harmful: it results in memory leak and potentially can lead to a situation where different parts of QEMU use different sets of timers. To avoid it remove init_clocks call from main and add an assertion to qemu_clock_init that corresponding clock has not been initialized yet. Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
| -rw-r--r-- | qemu-timer.c | 3 | ||||
| -rw-r--r-- | vl.c | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/qemu-timer.c b/qemu-timer.c index 9be1a4131d..00a5d35c3f 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -126,6 +126,9 @@ static void qemu_clock_init(QEMUClockType type) { QEMUClock *clock = qemu_clock_ptr(type); + /* Assert that the clock of type TYPE has not been initialized yet. */ + assert(main_loop_tlg.tl[type] == NULL); + clock->type = type; clock->enabled = true; clock->last = INT64_MIN; diff --git a/vl.c b/vl.c index 73e06610b0..709d8cda8d 100644 --- a/vl.c +++ b/vl.c @@ -3024,7 +3024,6 @@ int main(int argc, char **argv, char **envp) runstate_init(); - init_clocks(); rtc_clock = QEMU_CLOCK_HOST; qemu_init_auxval(envp); |