[CRIU] [PATCH] kerndat: munmap when stat call fail
Libo Chen
clbchenlibo.chen at huawei.com
Fri May 3 06:32:20 EDT 2013
Avoid memleak in err case
Signed-off-by: Libo Chen <libo.chen at huawei.com>
---
kerndat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kerndat.c b/kerndat.c
index 9c5157d..4f00336 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -34,6 +34,7 @@ static int kerndat_get_shmemdev(void)
sprintf(maps, "/proc/self/map_files/%lx-%lx",
(unsigned long)map, (unsigned long)map + PAGE_SIZE);
if (stat(maps, &buf) < 0) {
+ munmap(map, PAGE_SIZE);
pr_perror("Can't stat piggie");
return -1;
}
--
1.7.10.4
More information about the CRIU
mailing list