2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

timeval: Fix seq memory leak

'timewarp_seq' should be initialized only once, while init_clock() is
called multiple times (once for each clock instance).

Found by valgrind

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
Daniele Di Proietto
2014-10-03 15:04:15 -07:00
committed by Jarno Rajahalme
parent 88ace79b3e
commit 33c24cf9f4

View File

@@ -114,7 +114,6 @@ init_clock(struct clock *c, clockid_t id)
ovs_mutex_init(&c->mutex);
atomic_init(&c->slow_path, false);
xclock_gettime(c->id, &c->cache);
timewarp_seq = seq_create();
memset(&c->large_warp, 0, sizeof(c->large_warp));
}
@@ -125,6 +124,7 @@ do_init_time(void)
coverage_init();
timewarp_seq = seq_create();
init_clock(&monotonic_clock, (!clock_gettime(CLOCK_MONOTONIC, &ts)
? CLOCK_MONOTONIC
: CLOCK_REALTIME));