[CRIU] [PATCH 2/2] proc: fix memory leak
Andrey Vagin
avagin at openvz.org
Sun Jul 7 16:18:38 EDT 2013
timer is not freed in case of eof.
CID 1042301 (#1 of 1): Resource leak (RESOURCE_LEAK)
15. leaked_storage: Variable timer going out of scope leaks the storage it points to.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
proc_parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proc_parse.c b/proc_parse.c
index b4ba80c..c174a5d 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1199,6 +1199,7 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
&timer->spt.clock_id);
if (ret != 7) {
ret = 0;
+ xfree(timer);
if (feof(file))
goto out;
goto err;
@@ -1225,7 +1226,6 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
args->timer_n++;
}
err:
- xfree(timer);
while (!list_empty(&args->timers)) {
timer = list_first_entry(&args->timers, struct proc_posix_timer, list);
list_del(&timer->list);
--
1.8.3.1
More information about the CRIU
mailing list