mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
posix-timers: Helper for freeing proc parsed data
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
16
proc_parse.c
16
proc_parse.c
@@ -1337,6 +1337,16 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void free_posix_timers(struct proc_posix_timers_stat *st)
|
||||
{
|
||||
while (!list_empty(&st->timers)) {
|
||||
struct proc_posix_timer *timer;
|
||||
timer = list_first_entry(&st->timers, struct proc_posix_timer, list);
|
||||
list_del(&timer->list);
|
||||
xfree(timer);
|
||||
}
|
||||
}
|
||||
|
||||
int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -1409,11 +1419,7 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
|
||||
args->timer_n++;
|
||||
}
|
||||
err:
|
||||
while (!list_empty(&args->timers)) {
|
||||
timer = list_first_entry(&args->timers, struct proc_posix_timer, list);
|
||||
list_del(&timer->list);
|
||||
xfree(timer);
|
||||
}
|
||||
free_posix_timers(args);
|
||||
pr_perror("Parse error in posix timers proc file!");
|
||||
ret = -1;
|
||||
out:
|
||||
|
Reference in New Issue
Block a user