[CRIU] [PATCH 5/8] soccr: don't leak memory on error paths

Andrei Vagin avagin at openvz.org
Fri Feb 16 10:21:17 MSK 2018


[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

From: Andrei Vagin <avagin at virtuozzo.com>

CID 172198 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable sk going out of scope leaks the storage it points to.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/sk-tcp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 97e5a86c9..d1e250206 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -424,8 +424,10 @@ int restore_one_tcp(int fd, struct inet_sk_info *ii)
        if (!sk)
                return -1;

-       if (restore_tcp_conn_state(fd, sk, ii))
+       if (restore_tcp_conn_state(fd, sk, ii)) {
+               libsoccr_release(sk);
                return -1;
+       }

        return 0;
 }
--
2.13.6




More information about the CRIU mailing list