mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
dmsetup: fix timestamp leak
With a single report (--count=1) no timerfd is set up and the cycle and current timestamps should be freed during the single call to _update_interval_times().
This commit is contained in:
parent
62dce13c7a
commit
52be93c54b
@ -703,13 +703,16 @@ static int _update_interval_times(void)
|
|||||||
{
|
{
|
||||||
static struct dm_timestamp *this_timestamp = NULL;
|
static struct dm_timestamp *this_timestamp = NULL;
|
||||||
uint64_t delta_t, interval_num = _interval_num();
|
uint64_t delta_t, interval_num = _interval_num();
|
||||||
int r = 0;
|
int r = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clock shutdown for exit - nothing to do.
|
* Clock shutdown for exit - nothing to do.
|
||||||
*/
|
*/
|
||||||
if (_timer_fd == TIMER_STOPPED && !_cycle_timestamp)
|
if ((_timer_fd == TIMER_STOPPED) && !_cycle_timestamp)
|
||||||
return 1;
|
goto out;
|
||||||
|
|
||||||
|
/* clock is running */
|
||||||
|
r = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current timestamp. If _new_interval is set this is used as
|
* Current timestamp. If _new_interval is set this is used as
|
||||||
@ -780,7 +783,8 @@ static int _update_interval_times(void)
|
|||||||
r = 1;
|
r = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!r || _timer_fd == TIMER_STOPPED) {
|
/* timer stopped or never started */
|
||||||
|
if (!r || _timer_fd < 0) {
|
||||||
/* The _cycle_timestamp has not yet been allocated if we
|
/* The _cycle_timestamp has not yet been allocated if we
|
||||||
* fail to obtain this_timestamp on the first interval.
|
* fail to obtain this_timestamp on the first interval.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user