[lxc-devel] [lxcfs/master] bindings: fix memory leak in calc_pid()

aither64 on Github lxc-bot at linuxcontainers.org
Thu Jun 21 06:03:53 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 357 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180621/4201a3eb/attachment.bin>
-------------- next part --------------
From 832904c17476619af8fa74dd25b5f2dd9c52d095 Mon Sep 17 00:00:00 2001
From: Jakub Skokan <jakub.skokan at havefun.cz>
Date: Wed, 20 Jun 2018 20:24:28 +0200
Subject: [PATCH] bindings: fix memory leak in calc_pid()

Signed-off-by: Jakub Skokan <jakub.skokan at havefun.cz>
---
 bindings.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bindings.c b/bindings.c
index 4b6f51b..4ecd275 100644
--- a/bindings.c
+++ b/bindings.c
@@ -4521,6 +4521,8 @@ static int calc_pid(char ***pid_buf, char *dpath, int depth, int sum, int cfd)
 	}
 	fclose(f);
 out:
+	if (line)
+		free(line);
 	free(path);
 	return sum;
 }


More information about the lxc-devel mailing list