Commit 076ad01e authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

kerndat: munmap when stat call fail

Avoid memleak in err case
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent befe5ad1
...@@ -34,6 +34,7 @@ static int kerndat_get_shmemdev(void) ...@@ -34,6 +34,7 @@ static int kerndat_get_shmemdev(void)
sprintf(maps, "/proc/self/map_files/%lx-%lx", sprintf(maps, "/proc/self/map_files/%lx-%lx",
(unsigned long)map, (unsigned long)map + PAGE_SIZE); (unsigned long)map, (unsigned long)map + PAGE_SIZE);
if (stat(maps, &buf) < 0) { if (stat(maps, &buf) < 0) {
munmap(map, PAGE_SIZE);
pr_perror("Can't stat piggie"); pr_perror("Can't stat piggie");
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment